diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 2eaa3940f82..beb3665c4d9 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1394,7 +1394,7 @@ bool pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind) func.type = ZEND_INTERNAL_FUNCTION; func.handler = funcs->handler; func.function_name = zend_string_init(funcs->fname, strlen(funcs->fname), dbh->is_persistent); - func.scope = dbh_obj->std.ce; + func.scope = pdo_dbh_ce; func.prototype = NULL; ZEND_MAP_PTR(func.run_time_cache) = rt_cache_size ? pecalloc(rt_cache_size, 1, dbh->is_persistent) : NULL; func.T = ZEND_OBSERVER_ENABLED; diff --git a/ext/pdo_sqlite/tests/gh20095.phpt b/ext/pdo_sqlite/tests/gh20095.phpt new file mode 100644 index 00000000000..8d691f99ee2 --- /dev/null +++ b/ext/pdo_sqlite/tests/gh20095.phpt @@ -0,0 +1,25 @@ +--TEST-- +GH-20095: Incorrect class name in deprecation message for PDO mixins +--EXTENSIONS-- +pdo_sqlite +--FILE-- +sqliteCreateFunction('my_test', [$this, "test"]); + } +} + +$pdo = new Foo('sqlite::memory:'); +$pdo->register(); +$pdo->query("SELECT my_test()"); + +?> +--EXPECTF-- +Deprecated: Method PDO::sqliteCreateFunction() is deprecated since 8.5, use Pdo\Sqlite::createFunction() instead in %s on line %d +foo