Bug #76814 [NEW]: file_get_contents fail when maxlen is given null value
| From: | adrien dot blandin at gmail dot com | Date: | Thu, 30 Aug 2018 08:00:38 +0000 |
| Subject: | Bug #76814 [NEW]: file_get_contents fail when maxlen is given null value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-216798@lists.php.net to get a copy of this message | ||
From: adrien dot blandin at gmail dot com
Operating system: Debian
PHP version: 7.1.21
Package: Filesystem function related
Bug Type: Bug
Bug description:file_get_contents fail when maxlen is given null value
Description:
------------
Signature of file_get_contents is ($filename, $use_include_path = false,
$context = null, $offset = 0, $maxlen = null) so null is an allowed
value for maxlen.
Yet, when I explicitly gave the default values in my call:
file_get_contents($filename, false, null, 0, null), no content is
found.
If I call the function with only the filename (so default values will be
used too), content is found.
If I explicitly gave default values for all parameters except maxlen,
content is found.
Test script:
---------------
echo 'default: ' . strlen(file_get_contents($filename)) . PHP_EOL;
echo 'without maxlen: ' . strlen(file_get_contents($filename, false,
null, 0)) . PHP_EOL;
echo 'with maxlen: ' . strlen(file_get_contents($filename, false, null,
0, null)) . PHP_EOL;
--
Edit bug report at https://bugs.php.net/bug.php?id=76814&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76814&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76814&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76814&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76814&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76814&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76814&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76814&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76814&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76814&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76814&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76814&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76814&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76814&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76814&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76814&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76814&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76814&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76814&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76814&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76814&r=mysqlcfg