|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 Patchesfirebird_statement.diff (last revision 2018-06-17 13:18 UTC by sim-mail at list dot ru)Pull RequestsHistoryAllCommentsChangesGit/SVN commits              [2018-07-06 14:10 UTC] ab@php.net
  [2018-07-06 14:10 UTC] ab@php.net
 
-Status: Open
+Status: Closed
  [2018-07-22 11:31 UTC] nikic@php.net
 
-Status: Closed
+Status: Re-Opened
  [2018-07-22 11:31 UTC] nikic@php.net
  [2018-07-22 11:50 UTC] nikic@php.net
 
-Status:      Re-Opened
+Status:      Closed
-Assigned To:
+Assigned To: nikic
  [2018-07-22 11:50 UTC] nikic@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
Description: ------------ Affects Versions: 7.0.x, 7.1.x, 7.2.x Memory leak when fetching a BLOB field Test script: --------------- <?php try { $dbh = new \PDO('firebird:dbname=localhost:employee', 'SYSDBA', 'masterkey'); $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $dbh->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false); $dbh->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_NATURAL); $sql = ' with recursive r(n) as ( select 1 from rdb$database union all select n+1 from r where n < 1000 ) select n, cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC from r '; echo "First used: " . memory_get_usage(true) . "<br>"; for ($i = 0; $i < 20; $i++) { $sth = $dbh->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); unset($rows); unset($sth); echo "$i itteration used: " . memory_get_usage(true) . "<br>"; } unset($dbh); echo "Last used: " . memory_get_usage(true) . "<br>"; } catch(Exception $e) { var_dump($e); } Expected result: ---------------- First used: 2097152 0 itteration used: 2097152 1 itteration used: 2097152 2 itteration used: 2097152 3 itteration used: 2097152 4 itteration used: 2097152 5 itteration used: 2097152 6 itteration used: 2097152 7 itteration used: 2097152 8 itteration used: 2097152 9 itteration used: 2097152 10 itteration used: 2097152 11 itteration used: 2097152 12 itteration used: 2097152 13 itteration used: 2097152 14 itteration used: 2097152 15 itteration used: 2097152 16 itteration used: 2097152 17 itteration used: 2097152 18 itteration used: 2097152 19 itteration used: 2097152 Last used: 2097152 Actual result: -------------- First used: 2097152 0 itteration used: 18874368 1 itteration used: 27262976 2 itteration used: 35651584 3 itteration used: 44040192 4 itteration used: 50331648 5 itteration used: 58720256 6 itteration used: 67108864 7 itteration used: 75497472 8 itteration used: 83886080 9 itteration used: 92274688 10 itteration used: 100663296 11 itteration used: 109051904 12 itteration used: 117440512 13 itteration used: 125829120 14 itteration used: 134217728 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes) in E:\php_test\test.php on line 25