Merge branch 'PHP-8.4'
* PHP-8.4: Fix memory leak when destroying PDORow
This commit is contained in:
@ -2400,6 +2400,7 @@ static void pdo_row_free_storage(zend_object *std)
|
||||
row->stmt->lazy_object_ref = NULL;
|
||||
OBJ_RELEASE(&row->stmt->std);
|
||||
}
|
||||
zend_object_std_dtor(std);
|
||||
}
|
||||
|
||||
static zend_object *pdo_row_new(zend_class_entry *ce)
|
||||
|
@ -2,16 +2,18 @@
|
||||
GH-18114 (pdo lazy object crash)
|
||||
--EXTENSIONS--
|
||||
pdo_sqlite
|
||||
--XLEAK--
|
||||
See https://github.com/php/php-src/issues/18114#issuecomment-2738069692, will be fixed in a later PR on lower branches
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new PDO('sqlite::memory:');
|
||||
$x = $db->query('select 1 as queryString');
|
||||
foreach ($x->fetch(PDO::FETCH_LAZY) as $entry) {
|
||||
$data = $x->fetch(PDO::FETCH_LAZY);
|
||||
foreach ($data as $entry) {
|
||||
var_dump($entry);
|
||||
}
|
||||
var_dump((array) $data);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
|
Reference in New Issue
Block a user