ID:               19959
 Updated by:       [EMAIL PROTECTED]
 Reported By:      holliwell at gmx dot net
 Status:           Closed
 Bug Type:         Documentation problem
 Operating System: win32/linux
 PHP Version:      4.2.3
 New Comment:

There is a Warning inside of the fgetc() docs:

This function may return Boolean FALSE, but may also return a
non-Boolean value which evaluates to FALSE, such as 0 or "". Please
read the section on Booleans for more information. Use the === operator
for testing the return value of this function.

if (0 == false) echo "Yes";
http://php.net/manual/en/types.comparisons.php


Previous Comments:
------------------------------------------------------------------------

[2004-08-24 10:22:19] wzfg at singtel dot com

Hi,frined,
I am Mr Wang Zhan Feng.
I think the bug on fgetc still existing. see my program:
test2.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>

<style type="text/css">
<!--
body {  margin-left: 10px; margin-right: 10px; margin-top: 16px;
margin-bottom: 16px }
-->
</style>
<!--
#!/usr/local/bin/php
-->
</head>
<body>
<?php
error_reporting(E_ALL);
$ifp=fopen("test2.php","rb");
while(true){
        $ic=fgetc($ifp);
        if($ic == false)break;
        print $ic;
}
fclose($ifp);
?>
</body>
</html>

Every time, the program run to 0, then it will stop, I tried to change
to other number, then it is OK.
I am testing on PHP ver 5.0.1

Thanks.

------------------------------------------------------------------------

[2003-01-20 14:20:06] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

The meat of /php4/ext/standard/file.c::fgetc() hasn't changed since rev
1.1  It's just too simple not to be binary safe.

------------------------------------------------------------------------

[2002-11-10 18:43:15] [EMAIL PROTECTED]

The first post suggests fgetc() is binary safe, anyone know since when?
 Marking this as open until it's documented.

------------------------------------------------------------------------

[2002-10-19 17:57:51] [EMAIL PROTECTED]

Is fgetc() binary safe now too?  Only fgets() has been documented as
such thus far.  fgetc() lacks documention on the matter altogether.

------------------------------------------------------------------------

[2002-10-19 10:56:45] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

fgets() is now binary safe in latest CVS.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/19959

-- 
Edit this bug report at http://bugs.php.net/?id=19959&edit=1

Reply via email to