From a89387b7e38c279801d471a8a1a5c26deb39218c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Schl=C3=BCter?= Date: Tue, 16 Sep 2008 23:34:31 +0000 Subject: [PATCH] - Fix #44425 (Extending PDO/MySQL class with a __call() function doesn't work) --- ext/pdo/pdo_dbh.c | 8 +++++--- ext/pdo_mysql/tests/pdo_mysql_subclass.phpt | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 83e7ca5de7..ccd7c5842e 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1273,9 +1273,7 @@ static union _zend_function *dbh_method_get( if (zend_u_hash_find(dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH], ztype, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) { - if (std_object_handlers.get_method) { - fbc = std_object_handlers.get_method(object_pp, lc_method_name, method_len TSRMLS_CC); - } + if (!fbc) { fbc = NULL; } @@ -1285,6 +1283,10 @@ static union _zend_function *dbh_method_get( } out: + if (std_object_handlers.get_method) { + fbc = std_object_handlers.get_method(object_pp, lc_method_name, method_len TSRMLS_CC); + } + pdo_zstr_efree(lc_method_name); return fbc; } diff --git a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt index 90d4fb25ba..ab21f8cdd4 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt @@ -36,7 +36,7 @@ if (version_compare(PHP_VERSION, '5.0.0', '<')) } public function __call($method, $args) { - print "__call()"; + print "__call(".var_export($method,true).", ".var_export($args, true).")\n"; // $this->protocol(); } @@ -74,8 +74,6 @@ if (version_compare(PHP_VERSION, '5.0.0', '<')) $db->exec('DROP TABLE IF EXISTS test'); print "done!\n"; ?> ---XFAIL-- -PDO doesn't like __call() --EXPECTF-- __construct('%s', '%s', '%s') exec('DROP TABLE IF EXISTS test') -- 2.40.0