From: Felipe Pena Date: Thu, 26 Mar 2009 12:53:39 +0000 (+0000) Subject: MFH: - Fixed bug #47769 (Strange extends PDO) X-Git-Tag: php-5.3.0RC2~275 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7c4a27376a47367b876d3800b4afe0cf4210596;p=php MFH: - Fixed bug #47769 (Strange extends PDO) --- diff --git a/NEWS b/NEWS index fef74ba1ca..4d48cd9682 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ PHP NEWS (Matteo) - Fixed bug #47771 (Exception during object construction from arg call calls object's destructor). (Dmitry) +- Fixed bug #47769 (Strange extends PDO). (Felipe) - Fixed bug #47714 (autoloading classes inside exception_handler leads to crashes). (Dmitry) - Fixed bug #47699 (autoload and late static binding). (Dmitry) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 8f443b0636..ef4d6a8b58 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1333,7 +1333,7 @@ static union _zend_function *dbh_method_get( lc_method_name = emalloc(method_len + 1); zend_str_tolower_copy(lc_method_name, method_name, method_len); - if (zend_hash_find(&dbh->ce->function_table, 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]) { @@ -1346,23 +1346,13 @@ 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) { - if (!fbc) { fbc = NULL; } - - goto out; } - /* got it */ } out: - if (!fbc) { - if (std_object_handlers.get_method) { - fbc = std_object_handlers.get_method(object_pp, method_name, method_len TSRMLS_CC); - } - } - efree(lc_method_name); return fbc; } diff --git a/ext/pdo/tests/bug47769.phpt b/ext/pdo/tests/bug47769.phpt new file mode 100644 index 0000000000..d3e49ae77f --- /dev/null +++ b/ext/pdo/tests/bug47769.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #47769 (Strange extends PDO) +--FILE-- +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