Bug #77545 [NEW]: wrong output of array_diff
| From: | bostjan dot kristl at gmail dot com | Date: | Wed, 30 Jan 2019 08:20:42 +0000 |
| Subject: | Bug #77545 [NEW]: wrong output of array_diff | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219283@lists.php.net to get a copy of this message | ||
From: bostjan dot kristl at gmail dot com
Operating system: Linux
PHP version: Irrelevant
Package: *General Issues
Bug Type: Bug
Bug description:wrong output of array_diff
Description:
------------
I have tested in version Debian 9, PHP 7.0.33-0+deb9u1 and CentOS Linux
release 7.6.1810, 7.2.14
array_diff in first example show, that is no difference between arrays
values
Test script:
---------------
$t1['c'] = 3;
$t1['i'] = 10;
$t1['iv'] = 10;
$t2['c'] = 3;
$t2['i'] = 10;
$t2['iv'] = 11;
var_dump(array_diff($t1,$t2));
var_dump(array_diff($t2,$t1));
Expected result:
----------------
array(1) {
["iv"]=>
int(11)
}
array(1) {
["iv"]=>
int(11)
}
Actual result:
--------------
array(0) {
}
array(1) {
["iv"]=>
int(11)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=77545&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77545&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77545&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77545&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77545&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77545&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77545&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77545&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77545&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77545&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77545&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77545&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77545&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77545&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77545&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77545&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77545&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77545&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77545&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77545&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77545&r=mysqlcfg