Bug #71090 [NEW]: Comparison operators loop
| From: | reallfqq-php at yahoo dot fr | Date: | Fri, 11 Dec 2015 12:19:11 +0000 |
| Subject: | Bug #71090 [NEW]: Comparison operators loop | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197785@lists.php.net to get a copy of this message | ||
From: reallfqq-php at yahoo dot fr
Operating system:
PHP version: 7.0.0
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Comparison operators loop
Description:
------------
PHP's comparison operators are circular, generatng situations where
impossible equalities are considered valid.
This bug is posted in reference to:
http://phpsadness.com/sad/52
Test script:
---------------
<?php
function is_sorted($array) {
$n = count($array);
for ($a=0; $a<$n-1; $a++) {
for ($b=$a+1; $b<$n; $b++) {
if ($array[$a] > $array[$b]) {
return false;
}
}
}
return true;
}
$array = array(INF, array(), (object)array());
sort($array);
var_dump(is_sorted($array))
?>
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=71090&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71090&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71090&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71090&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71090&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71090&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71090&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71090&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71090&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71090&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71090&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71090&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71090&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71090&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71090&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71090&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71090&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71090&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71090&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71090&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71090&r=mysqlcfg