forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.4: Added gc_handler to properly handle circular references. (php#16703)
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--TEST-- | ||
GH-16703: Memory leak of setFetchMode() | ||
--EXTENSIONS-- | ||
pdo | ||
--SKIPIF-- | ||
<?php | ||
$dir = getenv('REDIR_TEST_DIR'); | ||
if (false == $dir) die('skip no driver'); | ||
require_once $dir . 'pdo_test.inc'; | ||
PDOTest::skip(); | ||
?> | ||
--FILE-- | ||
<?php | ||
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); | ||
class TestStmt extends PDOStatement | ||
{ | ||
public $name; | ||
} | ||
|
||
$db = new PDO( | ||
getenv('PDOTEST_DSN'), | ||
getenv('PDOTEST_USER') ?: null, | ||
getenv('PDOTEST_PASS') ?: null, | ||
[ | ||
PDO::ATTR_CASE => PDO::CASE_LOWER, | ||
PDO::ATTR_STATEMENT_CLASS => [TestStmt::class], | ||
], | ||
); | ||
|
||
$db->exec('CREATE TABLE gh16703 (name varchar(255))'); | ||
$db->exec("INSERT INTO gh16703 (name) VALUES ('test_name')"); | ||
|
||
$stmt = $db->query('SELECT name FROM gh16703'); | ||
$t = $stmt; | ||
$stmt->setFetchMode(PDO::FETCH_INTO, $stmt); | ||
$stmt->fetch(); | ||
echo "done!\n"; | ||
?> | ||
--CLEAN-- | ||
<?php | ||
if (getenv('PDOTEST_DSN') === 'sqlite::memory:') return; | ||
|
||
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; | ||
$db = PDOTest::factory(); | ||
$db->exec('DROP TABLE gh16703'); | ||
?> | ||
--EXPECT-- | ||
done! |