Bug #78672 [NEW]: file_get_contents returns NULL instead of FALSE

From: Date: Mon, 14 Oct 2019 12:04:02 +0000
Subject: Bug #78672 [NEW]: file_get_contents returns NULL instead of FALSE
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223200@lists.php.net to get a copy of this message
From: php dot net-11012019 at 0pe dot de Operating system: Arch Linux PHP version: 7.3.10 Package: Streams related Bug Type: Bug Bug description:file_get_contents returns NULL instead of FALSE Description: ------------ When injecting 0 byte in first parameter of file_get_contents this will produce a warning and should return FALSE according PHP documentation. But the return is NULL. Test script: --------------- $fc1 = file_get_contents("not-existing-file.txt"); $fc2 = file_get_contents("not-existing-file.txt\0"); echo PHP_EOL; var_dump($fc1); var_dump($fc2); Expected result: ---------------- PHP Warning: file_get_contents(not-existing-file.txt): failed to open stream: No such file or directory in /home/arch/php-fgc-test.php on line 2 PHP Warning: file_get_contents() expects parameter 1 to be a valid path, string given in /home/arch/php-fgc-test.php on line 3 bool(false) bool(false) Actual result: -------------- PHP Warning: file_get_contents(not-existing-file.txt): failed to open stream: No such file or directory in /home/arch/php-fgc-test.php on line 2 PHP Warning: file_get_contents() expects parameter 1 to be a valid path, string given in /home/arch/php-fgc-test.php on line 3 bool(false) NULL -- Edit bug report at https://bugs.php.net/bug.php?id=78672&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78672&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78672&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78672&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78672&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78672&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78672&r=support Expected behavior: https://bugs.php.net/fix.php?id=78672&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78672&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78672&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78672&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78672&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78672&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78672&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78672&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78672&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78672&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78672&r=mysqlcfg

« previous php.bugs (#223200) next »