#43109 [NEW]: array_intersect() emits unexpected no of notices when 2d array is passed as arg
| From: | kraghuba at in dot ibm dot com | Date: | Fri, 26 Oct 2007 12:30:08 +0000 |
| Subject: | #43109 [NEW]: array_intersect() emits unexpected no of notices when 2d array is passed as arg | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-118983@lists.php.net to get a copy of this message | ||
From: kraghuba at in dot ibm dot com
Operating system: Linux, windows
PHP version: 6CVS-2007-10-26 (snap)
PHP Bug Type: Arrays related
Bug description: array_intersect() emits unexpected no of notices when 2d array is passed as arg
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 bug report at http://bugs.php.net/?id=43109&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43109&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43109&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43109&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43109&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43109&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43109&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43109&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43109&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43109&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43109&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43109&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43109&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43109&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43109&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43109&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43109&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43109&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43109&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43109&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43109&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43109&r=mysqlcfg