Req #71054 [Opn->Nab]: arsort() function backward incompatible.

From: Date: Tue, 08 Dec 2015 10:31:12 +0000
Subject: Req #71054 [Opn->Nab]: arsort() function backward incompatible.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197686@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71054&edit=1

 ID:                 71054
 Updated by:         laruence@php.net
 Reported by:        spongi1019 at naver dot com
 Summary:            arsort() function backward incompatible.
-Status:             Open
+Status:             Not a bug
 Type:               Feature/Change Request
 Package:            Arrays related
 Operating System:   CentOS 5.9
 PHP Version:        7.0.0
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

we are using stable sorting algo for elements less 16(actually  we will split elements into 16 by
using un-stable sorting algo)


Previous Comments:
------------------------------------------------------------------------
[2015-12-08 08:37:07] spongi1019 at naver dot com

Description:
------------
All the same, the value of element
Non-compatible features have been found in the function.

arsort()


PHP 5.2 ~ 5.6 result
----
array(4) {
  ["d"]=>
  int(1)
  ["c"]=>
  int(1)
  ["z"]=>
  int(1)
  ["a"]=>
  int(1)
}


PHP 7.0 result
----
array(4) {
  ["a"]=>
  int(1)
  ["z"]=>
  int(1)
  ["c"]=>
  int(1)
  ["d"]=>
  int(1)
}

Test script:
---------------
<?php
$arr = array(
    'a' => 1,
    'z' => 1,
    'c' => 1,
    'd' => 1
);

arsort($arr);
var_dump($arr);


Expected result:
----------------
array(4) {
  ["d"]=>
  int(1)
  ["c"]=>
  int(1)
  ["z"]=>
  int(1)
  ["a"]=>
  int(1)
}

Actual result:
--------------
array(4) {
  ["a"]=>
  int(1)
  ["z"]=>
  int(1)
  ["c"]=>
  int(1)
  ["d"]=>
  int(1)
}


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71054&edit=1


Thread (4 messages)

« previous php.bugs (#197686) next »