Skip to content

Commit 0ef5750

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix memory leak when destroying PDORow
2 parents 7d8e1c6 + 2dde07a commit 0ef5750

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ PHP NEWS
6565
(nielsdos)
6666
. Fixed bug GH-18112 (NULL access with preloading and INI option). (nielsdos)
6767

68+
- PDO:
69+
. Fix memory leak when destroying PDORow. (nielsdos)
70+
6871
- Standard:
6972
. Fix memory leaks in array_any() / array_all(). (nielsdos)
7073

ext/pdo/pdo_stmt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,6 +2502,7 @@ void pdo_row_free_storage(zend_object *std)
25022502
ZVAL_UNDEF(&row->stmt->lazy_object_ref);
25032503
OBJ_RELEASE(&row->stmt->std);
25042504
}
2505+
zend_object_std_dtor(std);
25052506
}
25062507

25072508
zend_object *pdo_row_new(zend_class_entry *ce)

ext/pdo_sqlite/tests/gh18114.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-18114 (pdo lazy object crash)
3+
--EXTENSIONS--
4+
pdo_sqlite
5+
--FILE--
6+
<?php
7+
$db = new PDO('sqlite::memory:');
8+
$x = $db->query('select 1 as queryString');
9+
$data = $x->fetch(PDO::FETCH_LAZY);
10+
foreach ($data as $entry) {
11+
var_dump($entry);
12+
}
13+
var_dump((array) $data);
14+
echo "Done\n";
15+
?>
16+
--EXPECT--
17+
array(0) {
18+
}
19+
Done

0 commit comments

Comments
 (0)