diff options
author | Gabriel Caruso <carusogabriel34@gmail.com> | 2018-08-04 21:42:03 -0300 |
---|---|---|
committer | Gabriel Caruso <carusogabriel34@gmail.com> | 2018-08-19 21:27:57 -0300 |
commit | efbf846fd256f0cd8a745d98182cb1f95d1e57f8 (patch) | |
tree | 12b46a741111e63a034cd44d02ad34f0e812dd69 /ext/standard/array.c | |
parent | 52ea129efb7b49aaa5c49c43d886602ee0a8d878 (diff) | |
download | php-git-efbf846fd256f0cd8a745d98182cb1f95d1e57f8.tar.gz |
Make array parsing parameters error messages consistency with ZPP failure
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r-- | ext/standard/array.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 187b7182a4..1049ec1fce 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -3752,7 +3752,7 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE zval *arg = args + i; if (Z_TYPE_P(arg) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg)); RETURN_NULL(); } } @@ -3781,7 +3781,7 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE zval *arg = args + i; if (Z_TYPE_P(arg) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg)); RETURN_NULL(); } count += zend_hash_num_elements(Z_ARRVAL_P(arg)); @@ -4639,7 +4639,7 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa for (i = 0; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); RETURN_NULL(); } } @@ -4810,7 +4810,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int for (i = 0; i < arr_argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); arr_argc = i; /* only free up to i - 1 */ goto out; } @@ -5050,7 +5050,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty for (i = 0; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); RETURN_NULL(); } } @@ -5221,7 +5221,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ for (i = 0; i < arr_argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); arr_argc = i; /* only free up to i - 1 */ goto out; } @@ -5398,7 +5398,7 @@ PHP_FUNCTION(array_diff) ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE(args[0]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #1 is not an array"); + php_error_docref(NULL, E_WARNING, "Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0])); RETURN_NULL(); } @@ -5406,7 +5406,7 @@ PHP_FUNCTION(array_diff) if (num == 0) { for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); RETURN_NULL(); } } @@ -5424,7 +5424,7 @@ PHP_FUNCTION(array_diff) if (!value) { for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); RETURN_NULL(); } } @@ -5436,7 +5436,7 @@ PHP_FUNCTION(array_diff) for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); RETURN_NULL(); } if (!found) { @@ -5466,7 +5466,7 @@ PHP_FUNCTION(array_diff) num = 0; for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); RETURN_NULL(); } num += zend_hash_num_elements(Z_ARRVAL(args[i])); @@ -6117,7 +6117,7 @@ PHP_FUNCTION(array_map) int ret; if (Z_TYPE(arrays[0]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d should be an array", 2); + php_error_docref(NULL, E_WARNING, "Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0])); return; } maxlen = zend_hash_num_elements(Z_ARRVAL(arrays[0])); @@ -6155,7 +6155,7 @@ PHP_FUNCTION(array_map) for (i = 0; i < n_arrays; i++) { if (Z_TYPE(arrays[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument #%d should be an array", i + 2); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[0])); efree(array_pos); return; } |