diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 58924b0dfae..942d2c2368d 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -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) diff --git a/ext/pdo_sqlite/tests/gh18114.phpt b/ext/pdo_sqlite/tests/gh18114.phpt index 6155bceeae9..85055884548 100644 --- a/ext/pdo_sqlite/tests/gh18114.phpt +++ b/ext/pdo_sqlite/tests/gh18114.phpt @@ -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-- 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