Edit report at https://bugs.php.net/bug.php?id=61961&edit=1
ID: 61961 Updated by: ni...@php.net Reported by: reeze dot xia at gmail dot com Summary: file_get_contents leaks when access empty file with maxlen set -Status: Open +Status: Closed Type: Bug Package: Streams related PHP Version: Irrelevant -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2012-05-06 11:47:35] ni...@php.net Automatic comment on behalf of reeze....@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=3e9923dd8d08f88740f58e54386c0f7c569a5aa6 Log: Fixed Bug #61961 (file_get_content leaks when access empty file with max length) ------------------------------------------------------------------------ [2012-05-06 10:19:22] reeze dot xia at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=61961&edit=1