Annotation of embedaddon/php/ext/standard/tests/array/bug50006_1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #50006 (Segfault caused by uksort()) - usort variant
! 3: --FILE--
! 4: <?php
! 5:
! 6: $data = array(
! 7: 'bar-bazbazbaz.',
! 8: 'bar-bazbazbaz-',
! 9: 'foo'
! 10: );
! 11: usort($data, 'magic_sort_cmp');
! 12: print_r($data);
! 13:
! 14: function 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: --EXPECTF--
! 24: Array
! 25: (
! 26: [0] => foo
! 27: [1] => bar-bazbazbaz-
! 28: [2] => bar-bazbazbaz.
! 29: )
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>