diff options
Diffstat (limited to 'ext/mysqli/mysqli.c')
| -rw-r--r-- | ext/mysqli/mysqli.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 05ffffa926..48a544d0c7 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -1200,16 +1200,9 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags fci.param_count = 0; fci.named_params = NULL; - if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { + if (ctor_params) { if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) { - /* Two problems why we throw exceptions here: PHP is typeless - * and hence passing one argument that's not an array could be - * by mistake and the other way round is possible, too. The - * single value is an array. Also we'd have to make that one - * argument passed by reference. - */ - zend_argument_error(zend_ce_exception, 3, "must be of type array, %s given", zend_zval_type_name(ctor_params)); - RETURN_THROWS(); + ZEND_UNREACHABLE(); } } @@ -1223,8 +1216,11 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags zval_ptr_dtor(&retval); } zend_fcall_info_args_clear(&fci, 1); - } else if (ctor_params) { - 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)); + } else if (ctor_params && zend_hash_num_elements(Z_ARRVAL_P(ctor_params)) > 0) { + zend_argument_error(zend_ce_exception, ERROR_ARG_POS(3), + "must be empty when the specified class (%s) does not have a constructor", + ZSTR_VAL(ce->name) + ); } } } |
