Skip to content

Commit cedee44

Browse files
committed
Fixed bug #77931
1 parent fb4c811 commit cedee44

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PHP NEWS
88
- Session:
99
. Fixed bug #77911 (Wrong warning for session.sid_bits_per_character). (cmb)
1010

11+
- Standard:
12+
. Fixed bug #77931 (Warning for array_map mentions wrong type). (Nikita)
13+
1114
02 May 2019, PHP 7.3.5
1215

1316
- Core:

ext/standard/array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6158,7 +6158,7 @@ PHP_FUNCTION(array_map)
61586158

61596159
for (i = 0; i < n_arrays; i++) {
61606160
if (Z_TYPE(arrays[i]) != IS_ARRAY) {
6161-
php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[0]));
6161+
php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i]));
61626162
efree(array_pos);
61636163
return;
61646164
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #77931: Warning for array_map mentions wrong type
3+
--FILE--
4+
<?php
5+
6+
array_map('trim', array(), 1);
7+
array_map('trim', array(), array(), true);
8+
array_map('trim', array(), array(), array(), null);
9+
10+
?>
11+
--EXPECTF--
12+
Warning: array_map(): Expected parameter 3 to be an array, int given in %s on line %d
13+
14+
Warning: array_map(): Expected parameter 4 to be an array, bool given in %s on line %d
15+
16+
Warning: array_map(): Expected parameter 5 to be an array, null given in %s on line %d

0 commit comments

Comments
 (0)