tony2001                Tue Dec 27 22:35:18 2005 EDT

  Modified files:              
    /php-src/ext/standard/tests/array   bug35821.phpt 
  Log:
  add test for #35821
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/tests/array/bug35821.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/array/bug35821.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug35821.phpt:1.2
--- /dev/null   Tue Dec 27 22:35:18 2005
+++ php-src/ext/standard/tests/array/bug35821.phpt      Tue Dec 27 22:35:18 2005
@@ -0,0 +1,34 @@
+--TEST--
+Bug #35821 (array_map() segfaults when exception is throwed from the callback)
+--FILE--
+<?php
+
+class Element
+{
+       public function ThrowException ()
+       {
+               throw new Exception();
+       }
+
+       public static function CallBack(Element $elem)
+       {
+               $elem->ThrowException();
+       }
+}
+
+$arr = array(new Element(), new Element(), new Element());
+array_map(array('Element', 'CallBack'), $arr);
+
+echo "Done\n";
+?>
+--EXPECTF--    
+
+Warning: array_map(): An error occurred while invoking the map callback in %s 
on line %d
+
+Fatal error: Uncaught exception 'Exception' in %s:%d
+Stack trace:
+#0 %s(%d): Element->ThrowException()
+#1 [internal function]: Element::CallBack(Object(Element))
+#2 %s(%d): array_map(Array, Array)
+#3 {main}
+  thrown in %s on line %d

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

Reply via email to