php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25631 fgets() problem
Submitted: 2003-09-23 03:14 UTC Modified: 2003-09-29 05:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: marqs10 at hotmail dot com Assigned:
Status: No Feedback Package: *Directory/Filesystem functions
PHP Version: 4.3.3 OS: XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-09-23 03:14 UTC] marqs10 at hotmail dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-23 03:24 UTC] sniper@php.net
Please provide a complete example script, which starts with <?php and ends with ?> like PHP scripts usually do..

 [2003-09-29 05:56 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 06:03:37 2021 UTC