From: Nikita Popov Date: Tue, 23 Apr 2019 09:40:13 +0000 (+0200) Subject: Fixed bug #77931 X-Git-Tag: php-7.3.6RC1~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cedee4408b21baed6376a2702d7d8d01e8d4a111;p=php Fixed bug #77931 --- diff --git a/NEWS b/NEWS index 396dbd1d42..ab5e05d867 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ PHP NEWS - Session: . Fixed bug #77911 (Wrong warning for session.sid_bits_per_character). (cmb) +- Standard: + . Fixed bug #77931 (Warning for array_map mentions wrong type). (Nikita) + 02 May 2019, PHP 7.3.5 - Core: diff --git a/ext/standard/array.c b/ext/standard/array.c index 3c8723fca7..f5cf77b01c 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -6158,7 +6158,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, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[0])); + php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i])); efree(array_pos); return; } diff --git a/ext/standard/tests/array/bug77931.phpt b/ext/standard/tests/array/bug77931.phpt new file mode 100644 index 0000000000..98a2eb91cf --- /dev/null +++ b/ext/standard/tests/array/bug77931.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #77931: Warning for array_map mentions wrong type +--FILE-- + +--EXPECTF-- +Warning: array_map(): Expected parameter 3 to be an array, int given in %s on line %d + +Warning: array_map(): Expected parameter 4 to be an array, bool given in %s on line %d + +Warning: array_map(): Expected parameter 5 to be an array, null given in %s on line %d