|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-09 07:31 UTC] svn@php.net
[2009-09-09 07:32 UTC] torben@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 02:00:01 2025 UTC |
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"