Bug #75649 [Opn->Fbk]: fgets second parameter causes memory leak
Edit report at https://bugs.php.net/bug.php?id=75649&edit=1
ID: 75649
Updated by: cmb@php.net
Reported by: zoolyka at gmail dot com
Summary: fgets second parameter causes memory leak
-Status: Open
+Status: Feedback
Type: Bug
-Package: *General Issues
+Package: Filesystem function related
Operating System: ubuntu
PHP Version: 5.6.32
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I cannot reproduce this with PHP-7.4. Is this still an issue for
you with any of the actively supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2017-12-07 17:46:53] zoolyka at gmail dot com
Description:
------------
If I specify a larger number then 8192 for fgets's length then PHP process starts to eat
memory.
Test script:
---------------
<?php
$handle = fopen('multi_gb_file', 'r');
while (
! feof($handle)
) {
$buffer = fgets($handle, 10485760);
}
fclose($handle);
?>
Expected result:
----------------
If length is much more then 8192 and the opened file is really huge then memory usage will rise up
to the size of the readed file's size.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75649&edit=1
Thread (3 messages)