From e81a660bae574337a87ad206c9094a935efa9b8e Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sun, 30 Dec 2007 17:59:31 +0000 Subject: [PATCH] - Fixed bug #43663 (Extending PDO class with a __call() function doesn't work). --- NEWS | 2 ++ ext/pdo/pdo_dbh.c | 10 ++++++++-- ext/pdo/tests/bug_43663.phpt | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 ext/pdo/tests/bug_43663.phpt diff --git a/NEWS b/NEWS index 8620bd4346..efa99285ab 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2008, PHP 5.2.6 - Fixed weired behavior in CGI parameter parsing. (Dmitry, Hannes Magnusson) +- Fixed bug #43663 (Extending PDO class with a __call() function doesn't work). + (David Soria Parra) - Fixed bug #43635 (mysql extension ingores INI settings on NULL values passed to mysql_connect()). (Ilia) - Fixed bug #43620 (Workaround for a bug inside libcurl 7.16.2 that can result diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index ff65aeb7f8..3781b9f961 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1273,12 +1273,18 @@ static union _zend_function *dbh_method_get( if (zend_hash_find(dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH], lc_method_name, method_len+1, (void**)&fbc) == FAILURE) { - fbc = NULL; + 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; + } + goto out; } /* got it */ } - + out: efree(lc_method_name); return fbc; diff --git a/ext/pdo/tests/bug_43663.phpt b/ext/pdo/tests/bug_43663.phpt new file mode 100644 index 0000000000..25af588bbe --- /dev/null +++ b/ext/pdo/tests/bug_43663.phpt @@ -0,0 +1,23 @@ +--TEST-- +PDO Common: Bug #43663 (__call on classes derived from PDO) +--FILE-- +--SKIPIF-- + +--FILE-- +foo(); +$a->bar(); +--EXPECT-- +Called foo in test +Called bar in test -- 2.50.1