summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2020-04-17 00:09:15 +0200
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-04-20 13:09:00 +0200
commit6111d64cda04a86e3a428edb36f064a187163825 (patch)
tree2842f8f5d7ecbd1e4033ca0bafd483db270528e5
parent283d37ad8f0e439cc6a454811946d9f7ccd25eb7 (diff)
downloadphp-git-6111d64cda04a86e3a428edb36f064a187163825.tar.gz
Improve a last couple of argument error messages
Closes GH-5404
-rw-r--r--ext/dba/dba.c2
-rw-r--r--ext/dba/tests/dba013.phpt2
-rw-r--r--ext/dba/tests/dba014.phpt2
-rw-r--r--ext/dom/document.c2
-rw-r--r--ext/ffi/ffi.c2
-rw-r--r--ext/hash/hash.c12
-rw-r--r--ext/hash/tests/reuse.phpt2
-rw-r--r--ext/mbstring/mbstring.c2
-rw-r--r--ext/mbstring/tests/mb_decode_numericentity.phpt2
-rw-r--r--ext/mbstring/tests/mb_encode_numericentity.phpt2
-rw-r--r--ext/standard/array.c18
-rwxr-xr-xext/standard/basic_functions.c2
-rw-r--r--ext/standard/dir.c2
-rw-r--r--ext/standard/file.c2
-rw-r--r--ext/standard/math.c4
-rw-r--r--ext/standard/mt_rand.c2
-rw-r--r--ext/standard/proc_open.c4
-rw-r--r--ext/standard/streamsfuncs.c2
-rw-r--r--ext/standard/string.c6
-rw-r--r--ext/standard/tests/array/array_chunk2.phpt4
-rw-r--r--ext/standard/tests/array/array_chunk_variation5.phpt12
-rw-r--r--ext/standard/tests/array/array_combine_error2.phpt6
-rw-r--r--ext/standard/tests/array/array_fill_error.phpt2
-rw-r--r--ext/standard/tests/array/array_pad.phpt2
-rw-r--r--ext/standard/tests/array/array_rand.phpt10
-rw-r--r--ext/standard/tests/array/array_rand_variation5.phpt8
-rw-r--r--ext/standard/tests/array/extract_error_variation1.phpt2
-rw-r--r--ext/standard/tests/array/range_errors.phpt22
-rw-r--r--ext/standard/tests/dir/readdir_variation7.phpt2
-rw-r--r--ext/standard/tests/file/flock.phpt2
-rw-r--r--ext/standard/tests/file/flock_error.phpt8
-rw-r--r--ext/standard/tests/general_functions/bug46587.phpt2
-rw-r--r--ext/standard/tests/general_functions/proc_open_array.phpt2
-rw-r--r--ext/standard/tests/general_functions/proc_open_pipes3.phpt2
-rw-r--r--ext/standard/tests/general_functions/register_tick_function_error.phpt2
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt4
-rw-r--r--ext/standard/tests/strings/explode.phpt8
-rw-r--r--ext/standard/tests/strings/explode1.phpt24
-rw-r--r--ext/standard/tests/strings/wordwrap.phpt2
-rw-r--r--ext/standard/tests/strings/wordwrap_error.phpt2
-rw-r--r--sapi/phpdbg/phpdbg.c2
-rw-r--r--win32/signal.c10
42 files changed, 105 insertions, 107 deletions
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 4e26157050..01fffa3259 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -107,7 +107,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
size_t len;
if (zend_hash_num_elements(Z_ARRVAL_P(key)) != 2) {
- zend_throw_error(NULL, "Key does not have exactly two elements: (key, name)");
+ zend_argument_error(NULL, 1, "must have exactly two elements: 'key' and 'name'");
return 0;
}
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos);
diff --git a/ext/dba/tests/dba013.phpt b/ext/dba/tests/dba013.phpt
index 8a446cf9a8..1871ce9cad 100644
--- a/ext/dba/tests/dba013.phpt
+++ b/ext/dba/tests/dba013.phpt
@@ -24,7 +24,7 @@ require(__DIR__ .'/clean.inc');
--EXPECTF--
database handler: %s
-Fatal error: Uncaught Error: Key does not have exactly two elements: (key, name) in %sdba013.php:6
+Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: 'key' and 'name' in %s.php:%d
Stack trace:
#0 %sdba013.php(6): dba_insert(Array, '%s', Resource id #%d)
#1 {main}
diff --git a/ext/dba/tests/dba014.phpt b/ext/dba/tests/dba014.phpt
index 410c3af3c1..2b7c2b7b25 100644
--- a/ext/dba/tests/dba014.phpt
+++ b/ext/dba/tests/dba014.phpt
@@ -24,7 +24,7 @@ require(__DIR__ .'/clean.inc');
--EXPECTF--
database handler: %s
-Fatal error: Uncaught Error: Key does not have exactly two elements: (key, name) in %sdba014.php:6
+Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: 'key' and 'name' in %s.php:%d
Stack trace:
#0 %sdba014.php(6): dba_insert(Array, '%s', Resource id #%d)
#1 {main}
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 6d037a7f77..919c594086 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -2082,7 +2082,7 @@ PHP_METHOD(DOMDocument, registerNodeClass)
RETURN_TRUE;
}
- zend_throw_error(NULL, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name));
+ zend_argument_error(NULL, 2, "must be a class name derived from %s or null, '%s' given", ZSTR_VAL(basece->name), ZSTR_VAL(ce->name));
}
/* }}} */
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index ba1130a64e..55c1b7093b 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -993,7 +993,7 @@ static zval *zend_ffi_cdata_get(zend_object *obj, zend_string *member, int read_
#endif
if (UNEXPECTED(!zend_string_equals_literal(member, "cdata"))) {
- zend_throw_error(zend_ffi_exception_ce, "only 'cdata' property may be read");
+ zend_throw_error(zend_ffi_exception_ce, "Only 'cdata' property may be read");
return &EG(uninitialized_zval);;
}
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 7350572d0a..25c816d47a 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -410,9 +410,9 @@ PHP_FUNCTION(hash_init)
}
/* }}} */
-#define PHP_HASHCONTEXT_VERIFY(func, hash) { \
+#define PHP_HASHCONTEXT_VERIFY(hash) { \
if (!hash->context) { \
- zend_throw_error(NULL, "%s(): supplied resource is not a valid Hash Context resource", func); \
+ zend_argument_type_error(1, "must be a valid Hash Context resource"); \
RETURN_THROWS(); \
} \
}
@@ -430,7 +430,7 @@ PHP_FUNCTION(hash_update)
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
- PHP_HASHCONTEXT_VERIFY("hash_update", hash);
+ PHP_HASHCONTEXT_VERIFY(hash);
hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(data), ZSTR_LEN(data));
RETURN_TRUE;
@@ -451,7 +451,7 @@ PHP_FUNCTION(hash_update_stream)
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
- PHP_HASHCONTEXT_VERIFY("hash_update_stream", hash);
+ PHP_HASHCONTEXT_VERIFY(hash);
php_stream_from_zval(stream, zstream);
while (length) {
@@ -492,7 +492,7 @@ PHP_FUNCTION(hash_update_file)
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
- PHP_HASHCONTEXT_VERIFY("hash_update_file", hash);
+ PHP_HASHCONTEXT_VERIFY(hash);
context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(ZSTR_VAL(filename), "rb", REPORT_ERRORS, NULL, context);
@@ -525,7 +525,7 @@ PHP_FUNCTION(hash_final)
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
- PHP_HASHCONTEXT_VERIFY("hash_final", hash);
+ PHP_HASHCONTEXT_VERIFY(hash);
digest_len = hash->ops->digest_size;
digest = zend_string_alloc(digest_len, 0);
diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt
index 78df4b41af..2b99801ebf 100644
--- a/ext/hash/tests/reuse.phpt
+++ b/ext/hash/tests/reuse.phpt
@@ -13,4 +13,4 @@ catch (\Error $e) {
}
--EXPECT--
-hash_update(): supplied resource is not a valid Hash Context resource
+hash_update(): Argument #1 ($context) must be a valid Hash Context resource
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 163943cddf..652027f4c5 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -3333,7 +3333,7 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
/* conversion map */
i = zend_hash_num_elements(target_hash);
if (i % 4 != 0) {
- zend_value_error("count($convmap) must be a multiple of 4");
+ zend_argument_value_error(2, "must have a multiple of 4 elements");
RETURN_THROWS();
}
convmap = (int *)safe_emalloc(i, sizeof(int), 0);
diff --git a/ext/mbstring/tests/mb_decode_numericentity.phpt b/ext/mbstring/tests/mb_decode_numericentity.phpt
index 868554df31..00ef793065 100644
--- a/ext/mbstring/tests/mb_decode_numericentity.phpt
+++ b/ext/mbstring/tests/mb_decode_numericentity.phpt
@@ -42,4 +42,4 @@ aŒbœcŠdše€fg
&#100000000000
&#000000000000
f&ouml;o
-count($convmap) must be a multiple of 4
+mb_decode_numericentity(): Argument #2 ($convmap) must have a multiple of 4 elements
diff --git a/ext/mbstring/tests/mb_encode_numericentity.phpt b/ext/mbstring/tests/mb_encode_numericentity.phpt
index 3f14bfd48b..f7e8002383 100644
--- a/ext/mbstring/tests/mb_encode_numericentity.phpt
+++ b/ext/mbstring/tests/mb_encode_numericentity.phpt
@@ -31,4 +31,4 @@ try {
&#402;&#913;&#914;&#915;&#916;&#917;&#918;&#919;&#920;&#921;&#922;&#923;&#924;&#925;&#926;&#927;&#928;&#929;&#931;&#932;&#933;&#934;&#935;&#936;&#937;&#945;&#946;&#947;&#948;&#949;&#950;&#951;&#952;&#953;&#954;&#955;&#956;&#957;&#958;&#959;&#960;&#961;&#962;&#963;&#964;&#965;&#966;&#967;&#968;&#969;&#977;&#978;&#982;&#8226;&#8230;&#8242;&#8243;&#8254;&#8260;&#8472;&#8465;&#8476;&#8482;&#8501;&#8592;&#8593;&#8594;&#8595;&#8596;&#8629;&#8656;&#8657;&#8658;&#8659;&#8660;&#8704;&#8706;&#8707;&#8709;&#8711;&#8712;&#8713;&#8715;&#8719;&#8721;&#8722;&#8727;&#8730;&#8733;&#8734;&#8736;&#8743;&#8744;&#8745;&#8746;&#8747;&#8756;&#8764;&#8773;&#8776;&#8800;&#8801;&#8804;&#8805;&#8834;&#8835;&#8836;&#8838;&#8839;&#8853;&#8855;&#8869;&#8901;&#8968;&#8969;&#8970;&#8971;&#9001;&#9002;&#9674;&#9824;&#9827;&#9829;&#9830;
a&#338;b&#339;c&#352;d&#353;e&#8364;fg
föo
-count($convmap) must be a multiple of 4
+mb_encode_numericentity(): Argument #2 ($convmap) must have a multiple of 4 elements
diff --git a/ext/standard/array.c b/ext/standard/array.c
index dd7914f8c7..d86177b5f9 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2396,7 +2396,7 @@ PHP_FUNCTION(extract)
if (prefix) {
if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) {
- zend_value_error("Prefix is not a valid identifier");
+ zend_argument_value_error(3, "must be a valid identifier");
RETURN_THROWS();
}
}
@@ -2553,7 +2553,7 @@ PHP_FUNCTION(array_fill)
if (EXPECTED(num > 0)) {
if (sizeof(num) > 4 && UNEXPECTED(EXPECTED(num > 0x7fffffff))) {
- zend_value_error("Too many elements");
+ zend_argument_value_error(2, "is too large");
RETURN_THROWS();
} else if (UNEXPECTED(start_key > ZEND_LONG_MAX - num + 1)) {
zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
@@ -2602,7 +2602,7 @@ PHP_FUNCTION(array_fill)
} else if (EXPECTED(num == 0)) {
RETURN_EMPTY_ARRAY();
} else {
- zend_value_error("Number of elements can't be negative");
+ zend_argument_value_error(2, "must be greater than or equal to 0");
RETURN_THROWS();
}
}
@@ -2843,7 +2843,7 @@ long_str:
}
err:
if (err) {
- zend_value_error("Step exceeds the specified range");
+ zend_argument_value_error(3, "must not exceed the specified range");
RETURN_THROWS();
}
}
@@ -4322,7 +4322,7 @@ PHP_FUNCTION(array_pad)
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
pad_size_abs = ZEND_ABS(pad_size);
if (pad_size_abs < 0 || pad_size_abs - input_size > Z_L(1048576)) {
- zend_value_error("You may only pad up to 1048576 elements at a time");
+ zend_argument_value_error(2, "must be less than or equal to 1048576");
RETURN_THROWS();
}
@@ -5790,7 +5790,7 @@ PHP_FUNCTION(array_rand)
num_avail = zend_hash_num_elements(Z_ARRVAL_P(input));
if (num_avail == 0) {
- zend_value_error("Array is empty");
+ zend_argument_value_error(1, "cannot be empty");
RETURN_THROWS();
}
@@ -5831,7 +5831,7 @@ PHP_FUNCTION(array_rand)
}
if (num_req <= 0 || num_req > num_avail) {
- zend_value_error("Second argument has to be between 1 and the number of elements in the array");
+ zend_argument_value_error(2, "must be between 1 and the number of elements in argument #1 ($arg)");
RETURN_THROWS();
}
@@ -6318,7 +6318,7 @@ PHP_FUNCTION(array_chunk)
/* Do bounds checking for size parameter. */
if (size < 1) {
- zend_value_error("Size parameter expected to be greater than 0");
+ zend_argument_value_error(2, "must be greater than 0");
RETURN_THROWS();
}
@@ -6387,7 +6387,7 @@ PHP_FUNCTION(array_combine)
num_values = zend_hash_num_elements(values);
if (num_keys != num_values) {
- zend_value_error("Both parameters should have an equal number of elements");
+ zend_argument_value_error(1, "and argument #2 ($values) must have the same number of elements");
RETURN_THROWS();
}
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 8596ce4a50..32a82aae26 100755
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -2477,7 +2477,7 @@ PHP_FUNCTION(register_tick_function)
if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name)) {
efree(tick_fe.arguments);
- zend_type_error("Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
+ zend_argument_type_error(1, "must be a valid tick callback, '%s' given", ZSTR_VAL(function_name));
zend_string_release_ex(function_name, 0);
RETURN_THROWS();
} else if (function_name) {
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index da1af5ad74..547a3dbfd6 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -387,7 +387,7 @@ PHP_FUNCTION(readdir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ zend_argument_type_error(1, "must be a valid Directory resource");
RETURN_THROWS();
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f6a75946d1..d14d8fed25 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -348,7 +348,7 @@ PHP_FUNCTION(flock)
act = operation & 3;
if (act < 1 || act > 3) {
- zend_value_error("Illegal operation argument");
+ zend_argument_value_error(2, "must be either LOCK_SH, LOCK_EX, or LOCK_UN");
RETURN_THROWS();
}
diff --git a/ext/standard/math.c b/ext/standard/math.c
index ef52dcaf76..ca6c1f4b9d 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1005,11 +1005,11 @@ PHP_FUNCTION(base_convert)
}
if (frombase < 2 || frombase > 36) {
- zend_value_error("Invalid `from base' (" ZEND_LONG_FMT ")", frombase);
+ zend_argument_value_error(2, "must be between 2 and 36 (inclusive)");
RETURN_THROWS();
}
if (tobase < 2 || tobase > 36) {
- zend_value_error("Invalid `to base' (" ZEND_LONG_FMT ")", tobase);
+ zend_argument_value_error(3, "must be between 2 and 36 (inclusive)");
RETURN_THROWS();
}
diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index d83636ed01..d164ac3037 100644
--- a/ext/standard/mt_rand.c
+++ b/ext/standard/mt_rand.c
@@ -325,7 +325,7 @@ PHP_FUNCTION(mt_rand)
ZEND_PARSE_PARAMETERS_END();
if (UNEXPECTED(max < min)) {
- zend_value_error("max (" ZEND_LONG_FMT ") is smaller than min (" ZEND_LONG_FMT ")", max, min);
+ zend_argument_value_error(2, "must be greater than or equal to argument #1 ($min)");
RETURN_THROWS();
}
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 267874acb4..78cbeb4b3e 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -529,7 +529,7 @@ PHP_FUNCTION(proc_open)
zval *arg_zv;
uint32_t num_elems = zend_hash_num_elements(Z_ARRVAL_P(command_zv));
if (num_elems == 0) {
- zend_value_error("Command array must have at least one element");
+ zend_argument_value_error(1, "must have at least one element");
RETURN_THROWS();
}
@@ -662,7 +662,7 @@ PHP_FUNCTION(proc_open)
descriptors[ndesc].mode = DESC_FILE;
} else if (Z_TYPE_P(descitem) != IS_ARRAY) {
- zend_value_error("Descriptor item must be either an array or a File-Handle");
+ zend_argument_value_error(2, "must only contain arrays and File-Handles");
goto exit_fail;
} else {
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index e3e31a76cf..7875285f56 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1508,7 +1508,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
zval *val;
if (!GET_CTX_OPT(stream, "ssl", "crypto_method", val)) {
- zend_value_error("When enabling encryption you must specify the crypto type");
+ zend_argument_value_error(3, "must be specified when enabling encryption");
RETURN_THROWS();
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 4c0aaad974..33de160aa8 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -931,12 +931,12 @@ PHP_FUNCTION(wordwrap)
}
if (breakchar_len == 0) {
- zend_value_error("Break string cannot be empty");
+ zend_argument_value_error(3, "cannot be empty");
RETURN_THROWS();
}
if (linelength == 0 && docut) {
- zend_value_error("Can't force cut when width is zero");
+ zend_argument_value_error(4, "cannot be true when argument #2 ($width) is 0");
RETURN_THROWS();
}
@@ -1143,7 +1143,7 @@ PHP_FUNCTION(explode)
ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(delim) == 0) {
- zend_value_error("Empty delimiter");
+ zend_argument_value_error(1, "cannot be empty");
RETURN_THROWS();
}
diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt
index a49ccc4eae..f3846a1d78 100644
--- a/ext/standard/tests/array/array_chunk2.phpt
+++ b/ext/standard/tests/array/array_chunk2.phpt
@@ -24,8 +24,8 @@ var_dump(array_chunk($input_array, 10));
var_dump(array_chunk($input_array, 10, true));
?>
--EXPECT--
-Size parameter expected to be greater than 0
-Size parameter expected to be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
array(5) {
[0]=>
array(1) {
diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt
index fca31d51c8..be20656825 100644
--- a/ext/standard/tests/array/array_chunk_variation5.phpt
+++ b/ext/standard/tests/array/array_chunk_variation5.phpt
@@ -49,9 +49,9 @@ foreach ($sizes as $size){
*** Testing array_chunk() : usage variations ***
-- Testing array_chunk() when size = -1 --
-Size parameter expected to be greater than 0
-Size parameter expected to be greater than 0
-Size parameter expected to be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
-- Testing array_chunk() when size = 4 --
array(1) {
@@ -89,9 +89,9 @@ array(1) {
}
-- Testing array_chunk() when size = 0 --
-Size parameter expected to be greater than 0
-Size parameter expected to be greater than 0
-Size parameter expected to be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
+array_chunk(): Argument #2 ($size) must be greater than 0
-- Testing array_chunk() when size = 1.5 --
array(3) {
diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt
index 4eae53c120..66707238a4 100644
--- a/ext/standard/tests/array/array_combine_error2.phpt
+++ b/ext/standard/tests/array/array_combine_error2.phpt
@@ -47,8 +47,8 @@ array(0) {
}
-- Testing array_combine() function with empty array for $keys argument --
-Both parameters should have an equal number of elements
+array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements
-- Testing array_combine() function with empty array for $values argument --
-Both parameters should have an equal number of elements
+array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements
-- Testing array_combine() function by passing array with unequal number of elements --
-Both parameters should have an equal number of elements
+array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements
diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt
index 3a9423e2b8..f205647f51 100644
--- a/ext/standard/tests/array/array_fill_error.phpt
+++ b/ext/standard/tests/array/array_fill_error.phpt
@@ -24,4 +24,4 @@ try {
?>
--EXPECT--
*** Testing array_fill() : error conditions ***
-Number of elements can't be negative
+array_fill(): Argument #2 ($num) must be greater than or equal to 0
diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt
index e4f8c5ce7f..6efef020b9 100644
--- a/ext/standard/tests/array/array_pad.phpt
+++ b/ext/standard/tests/array/array_pad.phpt
@@ -84,4 +84,4 @@ array(4) {
[3]=>
float(2)
}
-You may only pad up to 1048576 elements at a time
+array_pad(): Argument #2 ($pad_size) must be less than or equal to 1048576
diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt
index 4aebe8c23d..d493e6c5a6 100644
--- a/ext/standard/tests/array/array_rand.phpt
+++ b/ext/standard/tests/array/array_rand.phpt
@@ -38,11 +38,11 @@ var_dump(array_rand(array(1,2,3), 2));
?>
--EXPECTF--
-Array is empty
-Array is empty
-Second argument has to be between 1 and the number of elements in the array
-Second argument has to be between 1 and the number of elements in the array
-Second argument has to be between 1 and the number of elements in the array
+array_rand(): Argument #1 ($arg) cannot be empty
+array_rand(): Argument #1 ($arg) cannot be empty
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
array(3) {
[0]=>
int(%d)
diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt
index 04e71bdc49..2d66b35f04 100644
--- a/ext/standard/tests/array/array_rand_variation5.phpt
+++ b/ext/standard/tests/array/array_rand_variation5.phpt
@@ -70,13 +70,13 @@ int(%d)
int(%d)
-- With num_req = 0 --
-Second argument has to be between 1 and the number of elements in the array
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
-- With num_req = -1 --
-Second argument has to be between 1 and the number of elements in the array
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
-- With num_req = -2 --
-Second argument has to be between 1 and the number of elements in the array
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
-- With num_req more than number of members in 'input' array --
-Second argument has to be between 1 and the number of elements in the array
+array_rand(): Argument #2 ($num_req) must be between 1 and the number of elements in argument #1 ($arg)
diff --git a/ext/standard/tests/array/extract_error_variation1.phpt b/ext/standard/tests/array/extract_error_variation1.phpt
index a0caafb213..a8fe2fa850 100644
--- a/ext/standard/tests/array/extract_error_variation1.phpt
+++ b/ext/standard/tests/array/extract_error_variation1.phpt
@@ -11,4 +11,4 @@ try {
}
?>
--EXPECT--
-Prefix is not a valid identifier
+extract(): Argument #3 ($prefix) must be a valid identifier
diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt
index 0bb3365582..9b86c32177 100644
--- a/ext/standard/tests/array/range_errors.phpt
+++ b/ext/standard/tests/array/range_errors.phpt
@@ -87,33 +87,33 @@ foreach( $step_arr as $step ) {
*** Testing error conditions ***
-- Testing ( (low < high) && (step = 0) ) --
-Step exceeds the specified range
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
+range(): Argument #3 ($step) must not exceed the specified range
-- Testing ( (low > high) && (step = 0) ) --
-Step exceeds the specified range
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
+range(): Argument #3 ($step) must not exceed the specified range
-- Testing ( (low < high) && (high-low < step) ) --
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
-- Testing ( (low > high) && (low-high < step) ) --
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
-- Testing other conditions --
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
range(): Argument #3 ($step) must be of type int|float, string given
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
Notice: A non well formed numeric value encountered in %s on line %d
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
-- Testing Invalid steps --
range(): Argument #3 ($step) must be of type int|float, string given
-Step exceeds the specified range
-Step exceeds the specified range
+range(): Argument #3 ($step) must not exceed the specified range
+range(): Argument #3 ($step) must not exceed the specified range
range(): Argument #3 ($step) must be of type int|float, string given
range(): Argument #3 ($step) must be of type int|float, string given
diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt
index a2c0ef059f..79511ccf8b 100644
--- a/ext/standard/tests/dir/readdir_variation7.phpt
+++ b/ext/standard/tests/dir/readdir_variation7.phpt
@@ -25,4 +25,4 @@ try {
--EXPECTF--
*** Testing readdir() : usage variations ***
resource(%d) of type (stream)
-%d is not a valid Directory resource
+readdir(): Argument #1 ($dir_handle) must be a valid Directory resource
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
index ab0cfc6f4e..68e0f3fd30 100644
--- a/ext/standard/tests/file/flock.phpt
+++ b/ext/standard/tests/file/flock.phpt
@@ -60,4 +60,4 @@ int(0)
bool(true)
int(0)
bool(true)
-Illegal operation argument
+flock(): Argument #2 ($operation) must be either LOCK_SH, LOCK_EX, or LOCK_UN
diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt
index dc9123543d..b346cd125a 100644
--- a/ext/standard/tests/file/flock_error.phpt
+++ b/ext/standard/tests/file/flock_error.phpt
@@ -57,13 +57,13 @@ unlink($file);
--EXPECT--
*** Testing error conditions ***
--- Iteration 0 ---
-Illegal operation argument
+flock(): Argument #2 ($operation) must be either LOCK_SH, LOCK_EX, or LOCK_UN
--- Iteration 1 ---
-Illegal operation argument
+flock(): Argument #2 ($operation) must be either LOCK_SH, LOCK_EX, or LOCK_UN
--- Iteration 2 ---
-Illegal operation argument
+flock(): Argument #2 ($operation) must be either LOCK_SH, LOCK_EX, or LOCK_UN
--- Iteration 3 ---
-Illegal operation argument
+flock(): Argument #2 ($operation) must be either LOCK_SH, LOCK_EX, or LOCK_UN
--- Iteration 4 ---
flock(): Argument #2 ($operation) must be of type int, array given
--- Iteration 5 ---
diff --git a/ext/standard/tests/general_functions/bug46587.phpt b/ext/standard/tests/general_functions/bug46587.phpt
index ee59feb444..d9b3044406 100644
--- a/ext/standard/tests/general_functions/bug46587.phpt
+++ b/ext/standard/tests/general_functions/bug46587.phpt
@@ -14,5 +14,5 @@ echo "Done.\n";
?>
--EXPECTF--
int(%d)
-max (3) is smaller than min (8)
+mt_rand(): Argument #2 ($max) must be greater than or equal to argument #1 ($min)
Done.
diff --git a/ext/standard/tests/general_functions/proc_open_array.phpt b/ext/standard/tests/general_functions/proc_open_array.phpt
index b2ab4d8c9f..7e822880d3 100644
--- a/ext/standard/tests/general_functions/proc_open_array.phpt
+++ b/ext/standard/tests/general_functions/proc_open_array.phpt
@@ -68,7 +68,7 @@ proc_close($proc);
?>
--EXPECT--
Empty command array:
-Command array must have at least one element
+proc_open(): Argument #1 ($cmd) must have at least one element
Nul byte in program name:
Command array element 1 contains a null byte
diff --git a/ext/standard/tests/general_functions/proc_open_pipes3.phpt b/ext/standard/tests/general_functions/proc_open_pipes3.phpt
index 848850b327..307fbbaa1d 100644
--- a/ext/standard/tests/general_functions/proc_open_pipes3.phpt
+++ b/ext/standard/tests/general_functions/proc_open_pipes3.phpt
@@ -32,7 +32,7 @@ echo "END\n";
?>
--EXPECTF--
Warning: proc_open(): pi is not a valid descriptor spec/mode in %s on line %d
-Descriptor item must be either an array or a File-Handle
+proc_open(): Argument #2 ($descriptorspec) must only contain arrays and File-Handles
array(4) {
[3]=>
resource(%d) of type (Unknown)
diff --git a/ext/standard/tests/general_functions/register_tick_function_error.phpt b/ext/standard/tests/general_functions/register_tick_function_error.phpt
index b71f1ea5d5..c44dbe0872 100644
--- a/ext/standard/tests/general_functions/register_tick_function_error.phpt
+++ b/ext/standard/tests/general_functions/register_tick_function_error.phpt
@@ -11,4 +11,4 @@ try {
}
?>
--EXPECT--
-Invalid tick callback 'a' passed
+register_tick_function(): Argument #1 ($function) must be a valid tick callback, 'a' given
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
index 279cfe7924..2f20aeeef5 100644
--- a/ext/standard/tests/math/base_convert_error.phpt
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -34,6 +34,6 @@ try {
?>
--EXPECT--
*** Testing base_convert() : error conditions ***
-Invalid `from base' (1)
-Invalid `to base' (37)
+base_convert(): Argument #2 ($frombase) must be between 2 and 36 (inclusive)
+base_convert(): Argument #3 ($tobase) must be between 2 and 36 (inclusive)
Object of class classA could not be converted to string
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
index 8375364175..f937c4e890 100644
--- a/ext/standard/tests/strings/explode.phpt
+++ b/ext/standard/tests/strings/explode.phpt
@@ -60,9 +60,9 @@ array (
4 => 'd',
)
d6bee42a771449205344c0938ad4f035
-Empty delimiter
-Empty delimiter
-Empty delimiter
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
array(1) {
[0]=>
string(0) ""
@@ -77,7 +77,7 @@ array(1) {
[0]=>
string(0) ""
}
-Empty delimiter
+explode(): Argument #1 ($separator) cannot be empty
array(1) {
[0]=>
string(3) "acb"
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
index cfc203b428..4d62aa029d 100644
--- a/ext/standard/tests/strings/explode1.phpt
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -98,15 +98,15 @@ var_dump( explode("b", $obj) );
--EXPECT--
*** Testing explode() for basic operations ***
-- Iteration 1 --
-Empty delimiter
-Empty delimiter
-Empty delimiter
-Empty delimiter
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
-- Iteration 2 --
-Empty delimiter
-Empty delimiter
-Empty delimiter
-Empty delimiter
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
-- Iteration 3 --
array(1) {
[0]=>
@@ -208,10 +208,10 @@ array(2) {
string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
-- Iteration 7 --
-Empty delimiter
-Empty delimiter
-Empty delimiter
-Empty delimiter
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
+explode(): Argument #1 ($separator) cannot be empty
-- Iteration 8 --
array(2) {
[0]=>
diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt
index 0563b2e77f..cb16b0fa37 100644
--- a/ext/standard/tests/strings/wordwrap.phpt
+++ b/ext/standard/tests/strings/wordwrap.phpt
@@ -40,4 +40,4 @@ try {
}
--EXPECT--
OK
-Break string cannot be empty
+wordwrap(): Argument #3 ($break) cannot be empty
diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt
index af0f8eb61b..a3f75de6fb 100644
--- a/ext/standard/tests/strings/wordwrap_error.phpt
+++ b/ext/standard/tests/strings/wordwrap_error.phpt
@@ -52,7 +52,7 @@ var_dump( wordwrap($str, $width, $break, $cut) );
-- width = 0 & cut = false --
string(39) "testing<br />\nwordwrap<br />\nfunction"
-- width = 0 & cut = true --
-Can't force cut when width is zero
+wordwrap(): Argument #4 ($cut) cannot be true when argument #2 ($width) is 0
-- width = -10 & cut = false --
string(39) "testing<br />\nwordwrap<br />\nfunction"
-- width = -10 & cut = true --
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 9e173d40d8..8a1d821394 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -429,7 +429,7 @@ static PHP_FUNCTION(phpdbg_color)
break;
default:
- zend_value_error("phpdbg detected an incorrect color constant");
+ zend_argument_value_error(1, "must be either PHPDBG_COLOR_PROMPT, PHPDBG_COLOR_NOTICE, or PHPDBG_COLOR_ERROR");
}
} /* }}} */
diff --git a/win32/signal.c b/win32/signal.c
index 27ebf835c9..26bedd1088 100644
--- a/win32/signal.c
+++ b/win32/signal.c
@@ -98,13 +98,13 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
#if ZTS
if (!tsrm_is_main_thread()) {
zend_throw_error(NULL, "CTRL events can only be received on the main thread");
- return;
+ RETURN_THROWS();
}
#endif
if (!php_win32_console_is_cli_sapi()) {
zend_throw_error(NULL, "CTRL events trapping is only supported on console");
- return;
+ RETURN_THROWS();
}
@@ -118,10 +118,8 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
}
if (!zend_is_callable(handler, 0, NULL)) {
- zend_string *func_name = zend_get_callable_name(handler);
- zend_type_error("%s is not a callable function name error", ZSTR_VAL(func_name));
- zend_string_release_ex(func_name, 0);
- return;
+ zend_argument_type_error(1, "must be a valid callable function name");
+ RETURN_THROWS();
}
if (!SetConsoleCtrlHandler(NULL, FALSE) || !SetConsoleCtrlHandler(php_win32_signal_system_ctrl_handler, add)) {