Bug #77931 [Opn->Asn]: Warning for array_map mentions wrong type
| From: | nikic@php.net | Date: | Tue, 23 Apr 2019 09:35:51 +0000 |
| Subject: | Bug #77931 [Opn->Asn]: Warning for array_map mentions wrong type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220568@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77931&edit=1
ID: 77931
Updated by: nikic@php.net
Reported by: domen at jollydeck dot com
Summary: Warning for array_map mentions wrong type
-Status: Open
+Status: Assigned
Type: Bug
Package: Arrays related
Operating System: Windows
PHP Version: 7.3.4
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2019-04-23 09:29:29] domen at jollydeck dot com
Description:
------------
Function array_map always emits warning "Warning: array_map(): Expected parameter 3 to be an
array, array given" if third parameter is not an array.
It looks like X in "X given" is type of the second parameter instead of the offending
parameter.
Test cases:
array_map('trim', array(), 1); â "array given"
array_map('trim', array(), true); â "array given"
array_map('trim', array(), null); â "array given"
array_map('trim', 1, true); â "int given"
array_map('trim', true, true); â "bool given"
Test script:
---------------
<?php
array_map('trim', array(), true);
?>
Expected result:
----------------
Warning: array_map(): Expected parameter 3 to be an array, bool given
Actual result:
--------------
Warning: array_map(): Expected parameter 3 to be an array, array given
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77931&edit=1