#49038 [NEW]: Wrong documentation for file_get_contents()

From: Date: Thu, 23 Jul 2009 18:59:45 +0000
Subject: #49038 [NEW]: Wrong documentation for file_get_contents()
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2541@lists.php.net to get a copy of this message
From: ryan at genius dot com Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Wrong documentation for file_get_contents() Description: ------------ The documentation for file_get_contents() is wrong. The default value of the maxlen param is stated to be -1 but, when looking at the C code, it is set to PHP_STREAM_COPY_ALL, not -1. Passing -1 will trigger a warning and return false. After looking at the C code, the default value is PHP_STREAM_COPY_ALL, not -1. Reproduce code: --------------- $fileContents = file_get_contents('file.txt', 0, null, -1, -1); Expected result: ---------------- Get the entire file into $fileContents Actual result: -------------- Warning: "length must be greater than or equal to zero" -- Edit bug report at http://bugs.php.net/?id=49038&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49038&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49038&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49038&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49038&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49038&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49038&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49038&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49038&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49038&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49038&r=support Expected behavior: http://bugs.php.net/fix.php?id=49038&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49038&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49038&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49038&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49038&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49038&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49038&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49038&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49038&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49038&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49038&r=mysqlcfg

« previous php.doc.bugs (#2541) next »