|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-26 23:31 UTC] tony2001@php.net
[2007-03-26 23:33 UTC] tony2001@php.net
[2007-03-27 11:26 UTC] jan at horde dot org
[2007-04-13 09:32 UTC] jan at horde dot org
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 08:00:01 2025 UTC |
Description: ------------ This is a really weird edge case. See the unit test pasted below. If I run this test on the command line, it works fine. But if run the same test through the web server, the sorting simply doesn't happen. Apache is version 2.2.0. Passing the array through mysort() by reference is important, if I sort the array directly, everything is working fine. Reproduce code: --------------- --TEST-- uasort --FILE-- <?php $array = array( array('sort' => 'Horde (horde)'), array('sort' => 'E-Mail Mobil (mimp)'), array('sort' => 'Webmail Dynamisch (dimp)')); function mysort(&$array) { uasort($array, create_function('$a, $b', '$cmp = strcoll(strtolower($a["sort"]), strtolower($b["sort"])); var_dump($a["sort"], $b["sort"], $cmp); return $cmp;')); } mysort($array); var_dump($array); ?> --EXPECT-- string(19) "E-Mail Mobil (mimp)" string(13) "Horde (horde)" int(-1) string(24) "Webmail Dynamisch (dimp)" string(19) "E-Mail Mobil (mimp)" int(1) string(13) "Horde (horde)" string(19) "E-Mail Mobil (mimp)" int(1) string(24) "Webmail Dynamisch (dimp)" string(13) "Horde (horde)" int(1) array(3) { [1]=> array(1) { ["sort"]=> string(19) "E-Mail Mobil (mimp)" } [0]=> array(1) { ["sort"]=> string(13) "Horde (horde)" } [2]=> array(1) { ["sort"]=> string(24) "Webmail Dynamisch (dimp)" } } Actual result: -------------- Result if run through apache: string(19) "E-Mail Mobil (mimp)" string(13) "Horde (horde)" int(-1) string(24) "Webmail Dynamisch (dimp)" string(19) "E-Mail Mobil (mimp)" int(1) string(13) "Horde (horde)" string(19) "E-Mail Mobil (mimp)" int(1) string(24) "Webmail Dynamisch (dimp)" string(13) "Horde (horde)" int(1) array(3) { [0]=> array(1) { ["sort"]=> string(13) "Horde (horde)" } [1]=> array(1) { ["sort"]=> string(19) "E-Mail Mobil (mimp)" } [2]=> array(1) { ["sort"]=> string(24) "Webmail Dynamisch (dimp)" } }