Bug #73617 [NEW]: Array diff output is wrong.
| From: | hello at bweston dot me | Date: | Mon, 28 Nov 2016 16:54:25 +0000 |
| Subject: | Bug #73617 [NEW]: Array diff output is wrong. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205673@lists.php.net to get a copy of this message | ||
From: hello at bweston dot me
Operating system: Linux
PHP version: Irrelevant
Package: Arrays related
Bug Type: Bug
Bug description:Array diff output is wrong.
Description:
------------
So I have the following
```
<?php
var_dump(array_diff(
[
'q1' => true,
'q2' => true,
'q3' => false,
'q4' => false,
],
[
'q1' => false,
'q2' => false,
'q3' => false,
'q4' => false,
]
));
```
Which produces: (https://3v4l.org/WSs2s)
```
array(2) {
["q1"]=>
bool(true)
["q2"]=>
bool(true)
}
```
Which is fine however with just one change it isn't seen. The following
produces an empty array yet there is a change. (https://3v4l.org/DlnBr)
```
<?php
var_dump(array_diff(
[
'q1' => true,
'q2' => true,
'q3' => false,
'q4' => false,
],
[
'q1' => false,
'q2' => true,
'q3' => false,
'q4' => false,
]
));
```
--
Edit bug report at https://bugs.php.net/bug.php?id=73617&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73617&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73617&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73617&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73617&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73617&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73617&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73617&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73617&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73617&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73617&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73617&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73617&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73617&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73617&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73617&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73617&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73617&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73617&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73617&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73617&r=mysqlcfg