com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/pdo/pdo _stmt.c
| From: | JulienPauli | Date: | Mon, 21 Mar 2016 14:39:48 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/pdo/pdo _stmt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91448@lists.php.net to get a copy of this message | ||
Commit: 5ba7b9af1b2a23e9cdbbf2915a271bce1317cee0
Author: Julien Pauli <jpauli@php.net> Mon, 21 Mar 2016 15:32:52 +0100
Parents: d26ca894020bc28eb55b153fac5548374d5ce16d abbe1551d6c9c26bf198699213e6b6586ea97d88
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5ba7b9af1b2a23e9cdbbf2915a271bce1317cee0
Log:
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
Updated NEWS
Reworked Fix bug #52098
Fix bug #52098
Conflicts:
ext/pdo/pdo_dbh.c
ext/pdo/pdo_stmt.c
Bugs:
https://bugs.php.net/52098
Changed paths:
MM ext/pdo/pdo_stmt.c
Diff:
diff --cc ext/pdo/pdo_stmt.c
index c86864a,a2ae2fd..fdf5415
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@@ -1228,37 -1243,37 +1228,36 @@@ static int pdo_stmt_verify_mode(pdo_stm
}
switch(mode) {
- case PDO_FETCH_FUNC:
- if (!fetch_all) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_FUNC is only
allowed in PDOStatement::fetchAll()" TSRMLS_CC);
- return 0;
- }
- return 1;
-
- case PDO_FETCH_LAZY:
- if (fetch_all) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_LAZY can't be
used with PDOStatement::fetchAll()" TSRMLS_CC);
- return 0;
- }
- /* fall through */
+ case PDO_FETCH_FUNC:
+ if (!fetch_all) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_FUNC is only
allowed in PDOStatement::fetchAll()");
+ return 0;
+ }
+ return 1;
- default:
- if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can only
be used together with PDO::FETCH_CLASS" TSRMLS_CC);
- return 0;
- }
- if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_CLASSTYPE can only
be used together with PDO::FETCH_CLASS" TSRMLS_CC);
- return 0;
- }
- if (mode >= PDO_FETCH__MAX) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "invalid fetch mode"
TSRMLS_CC);
- return 0;
- }
- /* no break; */
+ case PDO_FETCH_LAZY:
+ if (fetch_all) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_LAZY can't
be used with PDOStatement::fetchAll()");
+ return 0;
+ }
+ /* fall through */
-
+ default:
+ if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can
only be used together with PDO::FETCH_CLASS");
+ return 0;
+ }
+ if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_CLASSTYPE can
only be used together with PDO::FETCH_CLASS");
+ return 0;
+ }
+ if (mode >= PDO_FETCH__MAX) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "invalid fetch mode");
+ return 0;
+ }
+ /* no break; */
- case PDO_FETCH_CLASS:
- return 1;
+ case PDO_FETCH_CLASS:
+ return 1;
}
}
/* }}} */
@@@ -2210,17 -2240,19 +2209,18 @@@ static void dbstmt_prop_delete(zval *ob
}
}
-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(zend_object **object_pp, zend_string *method_name,
const zval *key)
{
zend_function *fbc = NULL;
- char *lc_method_name;
- zval *object = *object_pp;
+ zend_string *lc_method_name;
+ zend_object *object = *object_pp;
- lc_method_name = emalloc(method_len + 1);
- zend_str_tolower_copy(lc_method_name, method_name, method_len);
+ lc_method_name = zend_string_alloc(ZSTR_LEN(method_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name));
- if (zend_hash_find(&Z_OBJCE_P(object)->function_table, lc_method_name,
- method_len+1, (void**)&fbc) == FAILURE) {
+
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(object TSRMLS_CC);
+ if ((fbc = zend_hash_find_ptr(&object->ce->function_table, lc_method_name)) == NULL) {
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
/* instance not created by PDO object */
if (!stmt->dbh) {
goto out;
@@@ -2242,7 -2275,10 +2242,10 @@@
}
out:
+ zend_string_release(lc_method_name);
+ if (!fbc) {
- fbc = std_object_handlers.get_method(object_pp, method_name, method_len, key TSRMLS_CC);
++ fbc = std_object_handlers.get_method(object_pp, method_name, key);
+ }
- efree(lc_method_name);
return fbc;
}
@@@ -2622,7 -2685,7 +2625,8 @@@ static union _zend_function *row_method
return NULL;
}
- efree(lc_method_name);
+ zend_string_release(lc_method_name);
++
return fbc;
}