#43109 [Asn->Opn]: array_intersect() emits unexpected no of notices when 2d array is passed as arg
| From: | jani@php.net | Date: | Mon, 18 Feb 2008 11:25:10 +0000 |
| Subject: | #43109 [Asn->Opn]: array_intersect() emits unexpected no of notices when 2d array is passed as arg | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-122391@lists.php.net to get a copy of this message | ||
ID: 43109
Updated by: jani@php.net
Reported By: kraghuba at in dot ibm dot com
-Status: Assigned
+Status: Open
Bug Type: Arrays related
Operating System: Linux, windows
PHP Version: 6CVS-2007-10-26 (snap)
Assigned To: jani
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/?id=43109&edit=1