Annotation of embedaddon/php/ext/standard/tests/array/bug36975.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #36975 (natcasesort() causes array_pop() to misbehave)
! 3: --FILE--
! 4: <?php
! 5: $a = array('aa', 'aa', 'bb', 'bb', 'cc', 'cc');
! 6: $test = natcasesort($a);
! 7: if ($test) {
! 8: echo "natcasesort success!\n";
! 9: }
! 10: $val = array_pop($a);
! 11: $a[] = $val;
! 12: var_dump($a);
! 13:
! 14: $b = array(1 => 'foo', 0 => 'baz');
! 15: array_pop($b);
! 16: $b[] = 'bar';
! 17: array_push($b, 'bar');
! 18: print_r($b);
! 19:
! 20: $c = array(0, 0, 0, 0, 0);
! 21: asort($c);
! 22: array_pop($c);
! 23: $c[] = 'foo';
! 24: $c[] = 'bar';
! 25: var_dump($c);
! 26: ?>
! 27: --EXPECT--
! 28: natcasesort success!
! 29: array(6) {
! 30: [0]=>
! 31: string(2) "aa"
! 32: [1]=>
! 33: string(2) "aa"
! 34: [3]=>
! 35: string(2) "bb"
! 36: [2]=>
! 37: string(2) "bb"
! 38: [5]=>
! 39: string(2) "cc"
! 40: [6]=>
! 41: string(2) "cc"
! 42: }
! 43: Array
! 44: (
! 45: [1] => foo
! 46: [2] => bar
! 47: [3] => bar
! 48: )
! 49: array(6) {
! 50: [4]=>
! 51: int(0)
! 52: [3]=>
! 53: int(0)
! 54: [2]=>
! 55: int(0)
! 56: [1]=>
! 57: int(0)
! 58: [5]=>
! 59: string(3) "foo"
! 60: [6]=>
! 61: string(3) "bar"
! 62: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>