|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77931 Warning for array_map mentions wrong type
Submitted: 2019-04-23 09:29 UTC Modified: 2019-04-23 09:35 UTC
From: domen at jollydeck dot com Assigned: nikic (profile)
Status: Closed Package: Arrays related
PHP Version: 7.3.4 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
16 + 17 = ?
Subscribe to this entry?

 [2019-04-23 09:29 UTC] domen at jollydeck dot com
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:
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-23 09:35 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: nikic
 [2019-04-23 09:41 UTC]
Automatic comment on behalf of
Log: Fixed bug #77931
 [2019-04-23 09:41 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri May 14 18:01:22 2021 UTC