From:             marqs10 at hotmail dot com
Operating system: XP
PHP version:      4.3.3
PHP Bug Type:     *PDF functions
Bug description:  fgets() problem

Description:
------------
0 in a text file does not have a length- it returns as an empty string;
however,the echo line below does echo a 0 to the screen.  There is no way
to differentiate between a blank string and a string containing "0".  I
have not tried this on unix system yet, but definately does not work on
windows.

Reproduce code:
---------------
while(!feof($handle))
{ 
  
  $buffer= fgets($handle);

        echo "$buffer";

        
  

  if(strlen($buffer!=0))
  {  

     $x=(int)($buffer);
     $n=(int)($buffer);

Expected result:
----------------
it is a simple program that returns the word "ZERO"
if a 0 is in the buffer and returns a blank line if the buffer is empty.

Actual result:
--------------
a blank line is returned regardless if it is a 0 or a blank line.  example
data file-
655221583
127334
605
0
0

100000
100045
100015015
101015120
012100120
-5000
-2147483648

13

-- 
Edit bug report at http://bugs.php.net/?id=25631&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25631&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25631&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25631&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25631&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25631&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25631&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25631&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25631&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25631&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25631&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25631&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25631&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25631&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25631&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25631&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25631&r=float

Reply via email to