1--TEST-- 2Bug #50006 (Segfault caused by uksort()) - usort variant 3--FILE-- 4<?php 5 6$data = array( 7 'bar-bazbazbaz.', 8 'bar-bazbazbaz-', 9 'foo' 10); 11usort($data, 'magic_sort_cmp'); 12print_r($data); 13 14function magic_sort_cmp($a, $b) { 15 $a = substr($a, 1); 16 $b = substr($b, 1); 17 if (!$a) return $b ? -1 : 0; 18 if (!$b) return 1; 19 return magic_sort_cmp($a, $b); 20} 21 22?> 23--EXPECT-- 24Array 25( 26 [0] => foo 27 [1] => bar-bazbazbaz. 28 [2] => bar-bazbazbaz- 29) 30