Annotation of embedaddon/php/ext/standard/tests/array/bug45312.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #45312 (Segmentation fault on second request for array functions)
! 3: --FILE--
! 4: <?php
! 5: class cr {
! 6: private $priv_member;
! 7: function cr($val) {
! 8: $this->priv_member = $val;
! 9: }
! 10: static function comp_func_cr($a, $b) {
! 11: if ($a->priv_member === $b->priv_member) return 0;
! 12: return ($a->priv_member > $b->priv_member) ? 1 : -1;
! 13: }
! 14: static function comp_func_cr2($a, $b) {
! 15: echo ".";
! 16: if ($a->priv_member === $b->priv_member) return 0;
! 17: return ($a->priv_member < $b->priv_member) ? 1 : -1;
! 18: }
! 19: function dump() {
! 20: echo $this->priv_member . "\n";
! 21: }
! 22: }
! 23: $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
! 24: $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
! 25: $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr"));
! 26: foreach($result as $val) {
! 27: $val->dump();
! 28: }
! 29: $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr2"));
! 30: foreach($result as $val) {
! 31: $val->dump();
! 32: }
! 33: ?>
! 34: --EXPECT--
! 35: 9
! 36: 12
! 37: 23
! 38: ....9
! 39: 12
! 40: 23
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>