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