From: Dmitry Stogov Date: Thu, 19 Jun 2008 12:09:44 +0000 (+0000) Subject: Added test for bug #45312 X-Git-Tag: php-5.3.0alpha1~719 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4961c0c412bf65c186cda0be8d5e1b217b68b3e3;p=php Added test for bug #45312 --- diff --git a/ext/standard/tests/array/bug45312.phpt b/ext/standard/tests/array/bug45312.phpt new file mode 100644 index 0000000000..017defefae --- /dev/null +++ b/ext/standard/tests/array/bug45312.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #45312 (Segmentation fault on second request for array functions) +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } + static function comp_func_cr2($a, $b) { + echo "."; + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member < $b->priv_member) ? 1 : -1; + } + function dump() { + echo $this->priv_member . "\n"; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); +foreach($result as $val) { + $val->dump(); +} +$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr2")); +foreach($result as $val) { + $val->dump(); +} +?> +--EXPECT-- +9 +12 +23 +....9 +12 +23