mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-13998: Manage refcount of agg_context->val correctly (#14004)
This commit is contained in:
@@ -426,7 +426,6 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, int argc, sqlite3_va
|
||||
* the context */
|
||||
if (agg_context) {
|
||||
if (Z_ISUNDEF(retval)) {
|
||||
zval_ptr_dtor(&agg_context->val);
|
||||
return FAILURE;
|
||||
}
|
||||
zval_ptr_dtor(Z_REFVAL(agg_context->val));
|
||||
|
||||
25
ext/pdo_sqlite/tests/gh13998.phpt
Normal file
25
ext/pdo_sqlite/tests/gh13998.phpt
Normal file
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Fix GH-13998: Manage refcount of agg_context->val correctly
|
||||
--EXTENSIONS--
|
||||
pdo_sqlite
|
||||
--FILE--
|
||||
<?php
|
||||
$step = function () {
|
||||
throw new Exception();
|
||||
};
|
||||
$finalize = function () {
|
||||
};
|
||||
|
||||
$db = new PDO('sqlite::memory:');
|
||||
$db->query('CREATE TABLE test (a int, b int)');
|
||||
$stmt = $db->query('INSERT INTO test VALUES (1, 1), (2, 2), (3, 3)');
|
||||
$db->sqliteCreateAggregate('S', $step, $finalize, 1);
|
||||
|
||||
try {
|
||||
$db->query('SELECT S(a) FROM test');
|
||||
} catch (Exception $e) {
|
||||
echo 'done!';
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
done!
|
||||
Reference in New Issue
Block a user