|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-08-18 08:08 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 02:00:01 2025 UTC |
nazar, actually those are the same. You are comparing integer 0 to string "is" there which means PHP will cast "is" to int which is 0. 0==0. You can prove this to yourself by forcing a string sort: ksort($array, SORT_STRING);