1--TEST--
2Bug #50006 (Segfault caused by uksort())
3--FILE--
4<?php
5
6$data = array(
7    'bar-bazbazbaz.' => 0,
8    'bar-bazbazbaz-' => 0,
9    'foo' => 0,
10);
11uksort($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    [foo] => 0
27    [bar-bazbazbaz.] => 0
28    [bar-bazbazbaz-] => 0
29)
30