|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65709 Sorting an array gives different outputs when intl is enabled
Submitted: 2013-09-19 11:54 UTC Modified: 2016-04-24 04:22 UTC
Avg. Score:4.9 ± 0.3
Reproduced:7 of 7 (100.0%)
Same Version:6 (85.7%)
Same OS:5 (71.4%)
From: info at arnoldpistorius dot com Assigned:
Status: No Feedback Package: intl (PECL)
PHP Version: 5.5.3 OS: CENTOS 6.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: info at arnoldpistorius dot com
New email:
PHP Version: OS:


 [2013-09-19 11:54 UTC] info at arnoldpistorius dot com
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:
setlocale(LC_ALL, 'NL_nl');
$files = array('__Abstract.js', '', 'Delete.js', '', 'Copy.js', '');

sort($files, SORT_LOCALE_STRING);

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 => '',
  3 => '__Abstract.js',
  4 => '',
  5 => 'Copy.js',
  6 => '',
  7 => 'Delete.js',

But now and then the output is:

array (
  0 => '.',
  1 => '..',
  2 => '',
  3 => 'Copy.js',
  4 => '',
  5 => 'Delete.js',
  6 => '',
  7 => '__Abstract.js',


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [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
Corrected e-mail address typo
 [2016-04-12 13:27 UTC]
-Status: Open +Status: Feedback
 [2016-04-12 13:27 UTC]
Thanks for the report. I don't reproduce the random sort issue with your snippet. Furthermore, the actual result looks different from what it should output. Please provide a reliable snippet for this.

 [2016-04-24 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 22:01:26 2024 UTC