dmitry          Thu Jun 19 12:10:00 2008 UTC

  Modified files:              
    /php-src/ext/standard/tests/array   bug45312.phpt 
  Log:
  Added test for bug #45312
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug45312.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/array/bug45312.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug45312.phpt:1.2
--- /dev/null   Thu Jun 19 12:10:00 2008
+++ php-src/ext/standard/tests/array/bug45312.phpt      Thu Jun 19 12:10:00 2008
@@ -0,0 +1,40 @@
+--TEST--
+Bug #45312 (Segmentation fault on second request for array functions)
+--FILE--
+<?php
+class cr {
+    private $priv_member;
+    function cr($val) {
+        $this->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



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to