Bug #73232 [NEW]: Array ordering is inconsistant.

From: Date: Mon, 03 Oct 2016 09:54:47 +0000
Subject: Bug #73232 [NEW]: Array ordering is inconsistant.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204420@lists.php.net to get a copy of this message
From: robin at patenall dot org dot uk Operating system: Centos PHP version: 7.0.11 Package: Arrays related Bug Type: Bug Bug description:Array ordering is inconsistant. Description: ------------ It appears that when comparing two arrays with the same keys but in different orders it is possible for the first to be both less than and greater than the second. Test script: --------------- <?php $a = array("b" => 2, "a" => 4); $b = array("a" => 3, "b" => 3); /** $b = array("b" => 3, "a" => 3); This works correctly **/ if($a < $b) echo "a is less than b\n"; if($a <= $b) echo "a is less than or equal to b\n"; if($a > $b) echo "a is greater than b\n"; if($a >= $b) echo "a is greater than or equal to b\n"; if($a == $b) echo "a is equal to b\n"; if($a != $b) echo "a is not equal to b\n"; Expected result: ---------------- a is less than b a is less than or equal to b a is not equal to b Actual result: -------------- a is less than b a is less than or equal to b a is greater than b a is greater than or equal to b a is not equal to b -- Edit bug report at https://bugs.php.net/bug.php?id=73232&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73232&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73232&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73232&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73232&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73232&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73232&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73232&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73232&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73232&r=support Expected behavior: https://bugs.php.net/fix.php?id=73232&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73232&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73232&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73232&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73232&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73232&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73232&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73232&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73232&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73232&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73232&r=mysqlcfg

« previous php.bugs (#204420) next »