|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-09-19 12:00 UTC] info at arnoldpistorius dot com
-: info at arnoldpistoirus dot com
+: info at arnoldpistorius dot com
[2013-09-19 12:00 UTC] info at arnoldpistorius dot com
[2016-04-12 13:27 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2016-04-12 13:27 UTC] ab@php.net
[2016-04-24 04:22 UTC] pecl-dev at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 15:00:02 2025 UTC |
Description: ------------ I am trying to sort an array containing file names with SORT_LOCALE_STRING. However the result is not consistent when I refresh the page several times. It appears to be that the output randomly differs. This behaviour is only occuring when PHP is compiled with intl (--enable-intl) or the pecl extension intl is installed. I foudn this out when I was experiencing different behaviour on scandir, which does also a sort. You can reproduce the problem by executing the following script several times by pressing F5 in your browser. Test script: --------------- <?php setlocale(LC_ALL, 'NL_nl'); $files = array('__Abstract.js', '__Abstract.coffee', 'Delete.js', 'Delete.coffee', 'Copy.js', 'Copy.coffee'); sort($files, SORT_LOCALE_STRING); var_dump($files); ?> Expected result: ---------------- The script should always have the same output Actual result: -------------- Most of the times I get the following output: array ( 0 => '.', 1 => '..', 2 => '__Abstract.coffee', 3 => '__Abstract.js', 4 => 'Copy.coffee', 5 => 'Copy.js', 6 => 'Delete.coffee', 7 => 'Delete.js', ) But now and then the output is: array ( 0 => '.', 1 => '..', 2 => 'Copy.coffee', 3 => 'Copy.js', 4 => 'Delete.coffee', 5 => 'Delete.js', 6 => '__Abstract.coffee', 7 => '__Abstract.js', )