felipe          Thu Mar 26 12:51:30 2009 UTC

  Added files:                 
    /php-src/ext/pdo/tests      bug47769.phpt 

  Modified files:              
    /php-src/ext/pdo    pdo_dbh.c 
  Log:
  - Fixed bug #47769 (Strange extends PDO)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.165&r2=1.166&diff_format=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.165 php-src/ext/pdo/pdo_dbh.c:1.166
--- php-src/ext/pdo/pdo_dbh.c:1.165     Wed Mar 25 12:05:51 2009
+++ php-src/ext/pdo/pdo_dbh.c   Thu Mar 26 12:51:30 2009
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_dbh.c,v 1.165 2009/03/25 12:05:51 felipe Exp $ */
+/* $Id: pdo_dbh.c,v 1.166 2009/03/26 12:51:30 felipe Exp $ */
 
 /* The PDO Database Handle Class */
 
@@ -1342,8 +1342,7 @@
 
        lc_method_name = zend_u_str_tolower_dup(ztype, method_name, method_len);
 
-       if (zend_u_hash_find(&dbh->ce->function_table, ztype, lc_method_name,
-                       method_len+1, (void**)&fbc) == FAILURE) {
+       if ((fbc = std_object_handlers.get_method(object_pp, method_name, 
method_len TSRMLS_CC)) == NULL) {
                /* not a pre-defined method, nor a user-defined method; check
                 * the driver specific methods */
                if (!dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH]) {
@@ -1356,20 +1355,13 @@
 
                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 (!fbc) {
                                fbc = NULL;
                        }
-                       goto out;
                }
-               /* got it */
        }
 
 out:
-       if (!fbc && std_object_handlers.get_method) {
-               fbc = std_object_handlers.get_method(object_pp, method_name, 
method_len TSRMLS_CC);
-       }
-
        pdo_zstr_efree(lc_method_name);
        return fbc;
 }

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug47769.phpt?view=markup&rev=1.1
Index: php-src/ext/pdo/tests/bug47769.phpt
+++ php-src/ext/pdo/tests/bug47769.phpt
--TEST--
Bug #47769 (Strange extends PDO)
--FILE--
<?php

class test extends PDO
{
        protected function isProtected() {
                echo "this is a protected method.\n";
        }
        private function isPrivate() {
                echo "this is a private method.\n";
        }
    
    public function quote($str, $paramtype = NULL) {
        $this->isProtected();
        $this->isPrivate();
        print $str ."\n";
        }
}

$test = new test('sqlite:memory');
$test->quote('foo');
$test->isProtected();

?>
--EXPECTF--
this is a protected method.
this is a private method.
foo

Fatal error: Call to protected method test::isProtected() from context '' in %s 
on line %d



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to