From: tomas dot matousek at matfyz dot cz
Operating system: WinXP
PHP version: 5.0.0b3 (beta3)
PHP Bug Type: Zend Engine 2 problem
Bug description: Inconsistent comparing
Description:
------------
The way in which elements of an array are compared is inconsistent.
Reproduce code:
---------------
$a = $c = array("101a","100","6");
$b = $d = array("100","6","101a");
// standard comparison:
$f = create_function('$a,$b','return ($a<$b) ? -1:($a>$b ? +1:0);');
asort($a);
asort($b);
uasort($c,$f);
uasort($d,$f);
print_r($a);
print_r($b);
print_r($c);
print_r($d);
Expected result:
----------------
Than I would expect all 'print_r' print arrays with the same order of
values.
I would expect that items implicitly converted into numbers during
comparison should precede those of type string.
Actual result:
--------------
Array
(
[2] => 6
[1] => 100
[0] => 101a
)
Array
(
[2] => 101a
[1] => 6
[0] => 100
)
Array
(
[2] => 6
[1] => 100
[0] => 101a
)
Array
(
[2] => 101a
[1] => 6
[0] => 100
)
--
Edit bug report at http://bugs.php.net/?id=27142&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27142&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27142&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27142&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27142&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27142&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27142&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27142&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27142&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27142&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27142&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27142&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27142&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27142&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27142&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27142&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27142&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27142&r=float