blob: aac0e2a535a9e6f1e89dbe4acaf064961fd62d78 (
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()) - usort variant
--FILE--
<?php
$data = array(
'bar-bazbazbaz.',
'bar-bazbazbaz-',
'foo'
);
usort($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);
}
?>
--EXPECT--
Array
(
[0] => foo
[1] => bar-bazbazbaz.
[2] => bar-bazbazbaz-
)
|