Skip to content

Fix memory leak when destroying PDORow #18123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,7 @@ void pdo_row_free_storage(zend_object *std)
ZVAL_UNDEF(&row->stmt->lazy_object_ref);
OBJ_RELEASE(&row->stmt->std);
}
zend_object_std_dtor(std);
}

zend_object *pdo_row_new(zend_class_entry *ce)
Expand Down
19 changes: 19 additions & 0 deletions ext/pdo_sqlite/tests/gh18114.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
GH-18114 (pdo lazy object crash)
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PDO('sqlite::memory:');
$x = $db->query('select 1 as queryString');
$data = $x->fetch(PDO::FETCH_LAZY);
foreach ($data as $entry) {
var_dump($entry);
}
var_dump((array) $data);
echo "Done\n";
?>
--EXPECT--
array(0) {
}
Done
Loading