mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
pdo: Fix scope for PDO mixins in pdo_hash_methods() (#20200)
From what I see the incorrect scope is not observable in any other way. The mixin methods are completely invisible to Reflection and a SQLite function referring to a private method is still properly called as before. Fixes php/php-src#20095.
This commit is contained in:
4
NEWS
4
NEWS
@@ -26,6 +26,10 @@ PHP NEWS
|
|||||||
. Fixed bug GH-19994 (openssl_get_cipher_methods inconsistent with fetching).
|
. Fixed bug GH-19994 (openssl_get_cipher_methods inconsistent with fetching).
|
||||||
(Jakub Zelenka)
|
(Jakub Zelenka)
|
||||||
|
|
||||||
|
- PDO:
|
||||||
|
. Fixed bug GH-20095 (Incorrect class name in deprecation message for PDO
|
||||||
|
mixins). (timwolla)
|
||||||
|
|
||||||
- Phar:
|
- Phar:
|
||||||
. Fix potential buffer length truncation due to usage of type int instead
|
. Fix potential buffer length truncation due to usage of type int instead
|
||||||
of type size_t. (Girgias)
|
of type size_t. (Girgias)
|
||||||
|
|||||||
@@ -1394,7 +1394,7 @@ bool pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind)
|
|||||||
func.type = ZEND_INTERNAL_FUNCTION;
|
func.type = ZEND_INTERNAL_FUNCTION;
|
||||||
func.handler = funcs->handler;
|
func.handler = funcs->handler;
|
||||||
func.function_name = zend_string_init(funcs->fname, strlen(funcs->fname), dbh->is_persistent);
|
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;
|
func.prototype = NULL;
|
||||||
ZEND_MAP_PTR(func.run_time_cache) = rt_cache_size ? pecalloc(rt_cache_size, 1, dbh->is_persistent) : 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;
|
func.T = ZEND_OBSERVER_ENABLED;
|
||||||
|
|||||||
25
ext/pdo_sqlite/tests/gh20095.phpt
Normal file
25
ext/pdo_sqlite/tests/gh20095.phpt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
--TEST--
|
||||||
|
GH-20095: Incorrect class name in deprecation message for PDO mixins
|
||||||
|
--EXTENSIONS--
|
||||||
|
pdo_sqlite
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Foo extends PDO {
|
||||||
|
private function test() {
|
||||||
|
echo "foo";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register() {
|
||||||
|
$this->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
|
||||||
Reference in New Issue
Block a user