From: Operating system: PHP version: Irrelevant Package: Streams related Bug Type: Bug Bug description:file_get_contents leaks when access empty file with maxlen set
Description: ------------ when access a empty file with file_get_contents($empty_file, NULL, NULL, NULL, 10); Test script: --------------- <?php $tmp_empty_file = __FILE__ . ".tmp"; file_put_contents($tmp_empty_file, ""); var_dump(file_get_contents($tmp_empty_file, NULL, NULL, NULL, 10)); Expected result: ---------------- string(0) "" without memory leaks Actual result: -------------- string(0) "" ==DONE== [Sun May 6 18:11:17 2012] Script: '/Users/reeze/Opensource/php-src- 5.3/ext/standard/tests/file/bugXXXX.php' /Users/reeze/Opensource/php-src-5.3/main/streams/streams.c(1360) : Freeing 0x10AB26F40 (11 bytes), script=/Users/reeze/Opensource/php-src- 5.3/ext/standard/tests/file/bugX XXX.php /Users/reeze/Opensource/php-src-5.3/ext/standard/file.c(570) : Actual location (location was relayed) === Total 1 memory leaks detected === -- Edit bug report at https://bugs.php.net/bug.php?id=61961&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61961&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61961&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61961&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61961&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61961&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61961&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61961&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61961&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61961&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61961&r=support Expected behavior: https://bugs.php.net/fix.php?id=61961&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61961&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61961&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61961&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61961&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61961&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61961&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61961&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61961&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61961&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61961&r=mysqlcfg