Bug #77931 [Asn->Csd]: Warning for array_map mentions wrong type

From: Date: Tue, 23 Apr 2019 09:41:22 +0000
Subject: Bug #77931 [Asn->Csd]: Warning for array_map mentions wrong type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220569@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: Assigned +Status: Closed Type: Bug Package: Arrays related Operating System: Windows PHP Version: 7.3.4 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=cedee4408b21baed6376a2702d7d8d01e8d4a111 Log: Fixed bug #77931 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

« previous php.bugs (#220569) next »