|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-11 00:05 UTC] chx1975 at gmail dot com
[2011-11-11 00:51 UTC] rasmus@php.net
[2011-11-11 00:51 UTC] rasmus@php.net
-Status: Open
+Status: Bogus
[2011-11-11 00:53 UTC] chx1975 at gmail dot com
[2012-03-09 14:11 UTC] taneli at crasman dot fi
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 03:00:01 2025 UTC |
Description: ------------ Some of the array_* functions that compare elements in multiple arrays do so by (string)$elem1 === (string)$elem2. If $elem1 or $elem2 is an array, then the array to string notice is thrown. Two examples of functions that can throw this are array_intersect() and array_diff(). If these functions are not expected to take arrays with other arrays as values, this should be mentioned on the documentation pages. Test script: --------------- <?php $left = array('b', array('a')); $right = array('a', 'd'); print_r(array_intersect($left, $right)); print_r(array_diff($left, $right)); Expected result: ---------------- Array ( ) Array ( [0] => b [1] => Array ( [0] => a ) ) Actual result: -------------- PHP Notice: Array to string conversion in /Users/simon/test.php on line 4 PHP Notice: Array to string conversion in /Users/simon/test.php on line 4 PHP Notice: Array to string conversion in /Users/simon/test.php on line 5 PHP Notice: Array to string conversion in /Users/simon/test.php on line 5 PHP Notice: Array to string conversion in /Users/simon/test.php on line 5 Notice: Array to string conversion in /Users/simon/test.php on line 4 Notice: Array to string conversion in /Users/simon/test.php on line 4 Array ( ) Notice: Array to string conversion in /Users/simon/test.php on line 5 Notice: Array to string conversion in /Users/simon/test.php on line 5 Notice: Array to string conversion in /Users/simon/test.php on line 5 Array ( [0] => b [1] => Array ( [0] => a ) )