]> granicus.if.org Git - php/commitdiff
- Fixed bug #43663 (Extending PDO class with a __call() function doesn't work).
authorDavid Soria Parra <dsp@php.net>
Sun, 30 Dec 2007 17:59:31 +0000 (17:59 +0000)
committerDavid Soria Parra <dsp@php.net>
Sun, 30 Dec 2007 17:59:31 +0000 (17:59 +0000)
NEWS
ext/pdo/pdo_dbh.c
ext/pdo/tests/bug_43663.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 8620bd43463ecca95159a2f3a67182eb4fc7927d..efa99285abbb3f1618cfe4d232ed5e2cd177df2a 100644 (file)
--- 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 
index ff65aeb7f8b6f50be1621d13d30f404fcba7f2d6..3781b9f9613ded28af1d1f19f0d662bb4cefd2a8 100755 (executable)
@@ -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 (file)
index 0000000..25af588
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+PDO Common: Bug #43663 (__call on classes derived from PDO)
+--FILE--
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+?>
+--FILE--
+<?php
+class test extends PDO{
+    function __call($name, array $args) {
+        echo "Called $name in ".__CLASS__."\n";
+    }
+    function foo() {
+        echo "Called foo in ".__CLASS__."\n";
+    }
+}
+$a = new test('sqlite::memory:');
+$a->foo();
+$a->bar();
+--EXPECT--
+Called foo in test
+Called bar in test