summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-05-09 17:29:56 +0200
committerAnatol Belski <ab@php.net>2016-05-09 17:29:56 +0200
commit148fa6bb440ece5060cee34fb23312c7e7e20a86 (patch)
tree90b99f81614f0cb7787926d1e0ee4a662ff3c057 /ext/mysqli/mysqli.c
parent7b65346b669d294283e37cb59bfa4fc3b17903c4 (diff)
parentfc2a45b70a6675cad627cfe6341dc77d61952ba4 (diff)
downloadphp-git-148fa6bb440ece5060cee34fb23312c7e7e20a86.tar.gz
Merge branch 'PHP-7.0'
* PHP-7.0: Revert "Fixed bug #71820 pg_fetch_object bind parameters before call constructor" Revert "Backport patch for bug #71820"
Diffstat (limited to 'ext/mysqli/mysqli.c')
-rw-r--r--ext/mysqli/mysqli.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index a907eed42f..8653f99c99 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -1271,13 +1271,15 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
zval dataset, retval;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
- zend_bool props_handled = 0;
ZVAL_COPY_VALUE(&dataset, return_value);
+
object_and_properties_init(return_value, ce, NULL);
if (!ce->default_properties_count && !ce->__set) {
Z_OBJ_P(return_value)->properties = Z_ARR(dataset);
- props_handled = 1;
+ } else {
+ zend_merge_properties(return_value, Z_ARRVAL(dataset));
+ zval_ptr_dtor(&dataset);
}
if (ce->constructor) {
@@ -1297,9 +1299,6 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
* single value is an array. Also we'd have to make that one
* argument passed by reference.
*/
- if (!props_handled) {
- zval_ptr_dtor(&dataset);
- }
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
return;
}
@@ -1312,14 +1311,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
fcc.object = Z_OBJ_P(return_value);
if (zend_call_function(&fci, &fcc) == FAILURE) {
- if (fci.params) {
- efree(fci.params);
- }
- if (!props_handled) {
- zval_ptr_dtor(&dataset);
- }
zend_throw_exception_ex(zend_ce_exception, 0, "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name));
- return;
} else {
zval_ptr_dtor(&retval);
}
@@ -1327,16 +1319,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
efree(fci.params);
}
} else if (ctor_params) {
- if (!props_handled) {
- zval_ptr_dtor(&dataset);
- }
zend_throw_exception_ex(zend_ce_exception, 0, "Class %s does not have a constructor hence you cannot use ctor_params", ZSTR_VAL(ce->name));
- return;
- }
-
- if (!props_handled) {
- zend_merge_properties(return_value, Z_ARRVAL(dataset));
- zval_ptr_dtor(&dataset);
}
}
}