Bug #70289 [Opn]: Different sort in php7 (and hhvm) compared to php5
| From: | cweiske@php.net | Date: | Tue, 18 Aug 2015 08:14:42 +0000 |
| Subject: | Bug #70289 [Opn]: Different sort in php7 (and hhvm) compared to php5 | ||
| References: | 1 | Groups: | php.bugs php.qa |
| Request: | Send a blank email to php-bugs+get-195265@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70289&edit=1
ID: 70289
Updated by: cweiske@php.net
Reported by: kjarli at gmail dot com
Summary: Different sort in php7 (and hhvm) compared to php5
Status: Open
Type: Bug
Package: Testing related
Operating System: Ubuntu 14.04
PHP Version: 7.0.0beta3
Block user comment: N
Private report: N
New Comment:
I saw the same in the PEAR core unit tests.
This only happens when the elements are equal. Since they are equal, the order of the elements is
unspecified and dependent on the internal implementation and the sort algorithm.
Not a bug in my eyes.
Previous Comments:
------------------------------------------------------------------------
[2015-08-18 08:08:13] kjarli at gmail dot com
Description:
------------
I haven't gotten a proper test setup, but I do have the travis builds. I was working on a
priority sorting feature and I had added a test to verify sort orders. On php5 it consistently went
right, but on php7 and hhvm it was in reversed order. I fixed it by adding a secondary sort
(strcmp).
Build #45 (failed):
https://travis-ci.org/iltar/http-bundle/builds/76059069
Build #46 (failed):
https://travis-ci.org/iltar/http-bundle/builds/76061283
Build #47 (fixed):
https://travis-ci.org/iltar/http-bundle/builds/76062321
The test in question:
https://github.com/iltar/http-bundle/blob/feature/property-accessor/test/DependencyInjection/DecorateRouterPassTest.php#L72-L112
It's about the one with a priority of 50, which is reversed as you can see in the failed
output.
Test script:
---------------
https://github.com/iltar/http-bundle/blob/feature/property-accessor/test/DependencyInjection/DecorateRouterPassTest.php#L72-L112
Expected result:
----------------
I expect to see consistent sorting, but that was not the case.
sequence:
app.henk2_50
app.henk_50
Actual result:
--------------
sequence:
app.henk_50
app.henk2_50
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70289&edit=1