Edit report at http://bugs.php.net/bug.php?id=43109&edit=1
ID: 43109 Updated by: fel...@php.net Reported by: kraghuba at in dot ibm dot com Summary: array_intersect() emits unexpected no of notices when 2d array is passed as arg -Status: Open +Status: Wont fix Type: Bug Package: Arrays related Operating System: Linux, windows PHP Version: 6CVS-2007-10-26 (snap) New Comment: Old trunk related. Previous Comments: ------------------------------------------------------------------------ [2007-10-26 12:30:08] kraghuba at in dot ibm dot com Description: ------------ when 2-d array is passed as argument to array_intersect() as first argument, it emits notices, which is expected because it expects an 1 dimensional array to be passed. The no. of notices that it emits when 2-d array is passed is more than expected number of. I suspect that this behavior is wrong. for example when the passed 2-d array has two sub arrays then two notices are expected but the number of emitted notices are more than 2 and that cannot be co-related. Please note that this behavior is only noticed on php6 with error_reporting = E_ALL Reproduce code: --------------- <?php $arr1 = array ( array(1, 2, "hello", 'world'), array(1, 2, 3, 4) ); $arr2 = array (1 => "one", 2 => "two", 3 => "three"); var_dump( array_intersect($arr1, $arr2) ); ?> Expected result: ---------------- Notice: Array to string conversion in %s on line %d Notice: Array to string conversion in %s on line %d Actual result: -------------- Notice: Array to string conversion in %s on line %d Notice: Array to string conversion in %s on line %d Notice: Array to string conversion in %s on line %d Notice: Array to string conversion in %s on line %d ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=43109&edit=1