Doc #55136 [NEW]: Code sample is wrong
| From: | rp_joe at yahoo dot com | Date: | Tue, 05 Jul 2011 13:52:44 +0000 |
| Subject: | Doc #55136 [NEW]: Code sample is wrong | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6833@lists.php.net to get a copy of this message | ||
From:
Operating system: xp
PHP version: Irrelevant
Package: *General Issues
Bug Type: Documentation Problem
Bug description:Code sample is wrong
Description:
------------
---
From manual page: http://www.php.net/function.fgets%23Examples
---
This code sample is wrong!
while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer;
}
When the
!== false is used it returns a value, whether the function
failed or not. In this example $buffer will be 1 or 0.
Test script:
---------------
while ($buffer = fgets($handle, 4096)) {
echo $buffer;
}
Expected result:
----------------
I expect to see a line of text read from the file and echoed.
Actual result:
--------------
0 or 1 is echoed.
--
Edit bug report at https://bugs.php.net/bug.php?id=55136&edit=1
--
Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55136&r=trysnapshot52
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55136&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55136&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55136&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55136&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55136&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55136&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55136&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55136&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55136&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55136&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55136&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55136&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55136&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55136&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55136&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55136&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55136&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55136&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55136&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55136&r=mysqlcfg
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55136&r=trysnapshot54