From 35ddc72b28812ee9b90941a35edbdaf3321d2ee0 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 26 Mar 2009 12:51:30 +0000 Subject: [PATCH] - Fixed bug #47769 (Strange extends PDO) --- ext/pdo/pdo_dbh.c | 10 +--------- ext/pdo/tests/bug47769.phpt | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 ext/pdo/tests/bug47769.phpt diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 1415929749..6bf0583849 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1342,8 +1342,7 @@ static union _zend_function *dbh_method_get( 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 @@ 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 (!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; } 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 -- 2.50.1