php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43109 array_intersect() emits unexpected no of notices when 2d array is passed as arg
Submitted: 2007-10-26 12:30 UTC Modified: 2010-06-21 00:29 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: kraghuba at in dot ibm dot com Assigned:
Status: Wont fix Package: Arrays related
PHP Version: 6CVS-2007-10-26 (snap) OS: Linux, windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kraghuba at in dot ibm dot com
New email:
PHP Version: OS:

 

 [2007-10-26 12:30 UTC] 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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-21 00:29 UTC] felipe@php.net
-Status: Open +Status: Wont fix
 [2010-06-21 00:29 UTC] felipe@php.net
Old trunk related.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC