Bug #61540 [NEW]: array_diff has problem when in second array is entry with null value
| From: | pfraszczak at power dot com dot pl | Date: | Wed, 28 Mar 2012 10:23:26 +0000 |
| Subject: | Bug #61540 [NEW]: array_diff has problem when in second array is entry with null value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-168916@lists.php.net to get a copy of this message | ||
From:
Operating system: ubuntu
PHP version: 5.3.10
Package: Scripting Engine problem
Bug Type: Bug
Bug description:array_diff has problem when in second array is entry with null value
Description:
------------
I notice that array_diff return empty array when in second array we have
entry with null value. When i removed entry with test key - everything
works fine.
Moreover it seems that null values in $a array don't brake array_diff
Test script:
---------------
$a = array('street'=>'','number'=>'n1');
$b =
array('street'=>'b1','number'=>'n1','test'=>null);
var_dump(array_diff($a,$b));
Expected result:
----------------
array(1) {
["street"]=>
string(0) ""
}
Actual result:
--------------
array(0) {
}
--
Edit bug report at https://bugs.php.net/bug.php?id=61540&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61540&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61540&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61540&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61540&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61540&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61540&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61540&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61540&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61540&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61540&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61540&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61540&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61540&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61540&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61540&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61540&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61540&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61540&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61540&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61540&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61540&r=mysqlcfg