Skip to content

Commit 0fcd0be

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: pdo: Fix scope for PDO mixins in pdo_hash_methods() (php#20200)
2 parents 81fef09 + 1cb166c commit 0fcd0be

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

ext/pdo/pdo_dbh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ bool pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind)
13941394
func.type = ZEND_INTERNAL_FUNCTION;
13951395
func.handler = funcs->handler;
13961396
func.function_name = zend_string_init(funcs->fname, strlen(funcs->fname), dbh->is_persistent);
1397-
func.scope = dbh_obj->std.ce;
1397+
func.scope = pdo_dbh_ce;
13981398
func.prototype = NULL;
13991399
ZEND_MAP_PTR(func.run_time_cache) = rt_cache_size ? pecalloc(rt_cache_size, 1, dbh->is_persistent) : NULL;
14001400
func.T = ZEND_OBSERVER_ENABLED;

ext/pdo_sqlite/tests/gh20095.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
GH-20095: Incorrect class name in deprecation message for PDO mixins
3+
--EXTENSIONS--
4+
pdo_sqlite
5+
--FILE--
6+
<?php
7+
8+
class Foo extends PDO {
9+
private function test() {
10+
echo "foo";
11+
}
12+
13+
public function register() {
14+
$this->sqliteCreateFunction('my_test', [$this, "test"]);
15+
}
16+
}
17+
18+
$pdo = new Foo('sqlite::memory:');
19+
$pdo->register();
20+
$pdo->query("SELECT my_test()");
21+
22+
?>
23+
--EXPECTF--
24+
Deprecated: Method PDO::sqliteCreateFunction() is deprecated since 8.5, use Pdo\Sqlite::createFunction() instead in %s on line %d
25+
foo

0 commit comments

Comments
 (0)