]> granicus.if.org Git - php/commitdiff
- Fix #44425 (Extending PDO/MySQL class with a __call() function doesn't work)
authorJohannes Schlüter <johannes@php.net>
Tue, 16 Sep 2008 23:34:31 +0000 (23:34 +0000)
committerJohannes Schlüter <johannes@php.net>
Tue, 16 Sep 2008 23:34:31 +0000 (23:34 +0000)
ext/pdo/pdo_dbh.c
ext/pdo_mysql/tests/pdo_mysql_subclass.phpt

index 83e7ca5de76310e8cbc365290d741f6af8be05ed..ccd7c5842ead9f1ebb0e38c243b5e176acc9e76a 100755 (executable)
@@ -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;
 }
index 90d4fb25bad0b759fdc1786194a77aaacf2d86a7..ab21f8cdd445a174827ff5e25a9f290b8d196cc8 100644 (file)
@@ -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')