com php-src: Reworked Fix bug #52098: ext/pdo/pdo_stmt.c
| From: | JulienPauli | Date: | Mon, 21 Mar 2016 14:23:18 +0000 |
| Subject: | com php-src: Reworked Fix bug #52098: ext/pdo/pdo_stmt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91449@lists.php.net to get a copy of this message | ||
Commit: d3d64b7c62cb7b63d854b1cbc6a032c4995cdba8
Author: Julien Pauli <jpauli@php.net> Mon, 21 Mar 2016 15:23:18 +0100
Parents: e541cd8e6bcf5a80b85379afa35e54a82c74bde2
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d3d64b7c62cb7b63d854b1cbc6a032c4995cdba8
Log:
Reworked Fix bug #52098
Bugs:
https://bugs.php.net/52098
Changed paths:
M ext/pdo/pdo_stmt.c
Diff:
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index db295ee..a2ae2fd 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2240,14 +2240,11 @@ static void dbstmt_prop_delete(zval *object, zval *member, const
zend_literal *k
}
}
-static union _zend_function *dbstmt_method_get(
- zval **object_pp,
- char *method_name, int method_len, const zend_literal *key TSRMLS_DC)
+static union _zend_function *dbstmt_method_get(zval **object_pp, char *method_name, int method_len,
const zend_literal *key TSRMLS_DC)
{
zend_function *fbc = NULL;
char *lc_method_name;
zval *object = *object_pp;
- zend_function *fbc_fallback = NULL;
lc_method_name = emalloc(method_len + 1);
zend_str_tolower_copy(lc_method_name, method_name, method_len);
@@ -2255,14 +2252,9 @@ static union _zend_function *dbstmt_method_get(
if (zend_hash_find(&Z_OBJCE_P(object)->function_table, lc_method_name,
method_len+1, (void**)&fbc) == FAILURE) {
- /* Prepare fallback by running standard method for functions.
- * If the function does not find a method to instanciate it will return this fallback method. */
- fbc_fallback = std_object_handlers.get_method(object_pp, method_name, method_len, key TSRMLS_CC);
-
pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(object TSRMLS_CC);
/* instance not created by PDO object */
if (!stmt->dbh) {
- fbc = fbc_fallback;
goto out;
}
/* not a pre-defined method, nor a user-defined method; check
@@ -2271,22 +2263,21 @@ static union _zend_function *dbstmt_method_get(
if (!pdo_hash_methods(stmt->dbh,
PDO_DBH_DRIVER_METHOD_KIND_STMT TSRMLS_CC)
|| !stmt->dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_STMT]) {
-
- fbc = fbc_fallback;
goto out;
}
}
if (zend_hash_find(stmt->dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_STMT],
lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
-
- fbc = fbc_fallback;
goto out;
}
/* got it */
}
out:
+ if (!fbc) {
+ fbc = std_object_handlers.get_method(object_pp, method_name, method_len, key TSRMLS_CC);
+ }
efree(lc_method_name);
return fbc;
}