xref: /PHP-5.6/ext/standard/tests/array/bug35821.phpt (revision a541bb80)
1--TEST--
2Bug #35821 (array_map() segfaults when exception is throwed from the callback)
3--FILE--
4<?php
5
6class Element
7{
8	public function ThrowException ()
9	{
10		throw new Exception();
11	}
12
13	public static function CallBack(Element $elem)
14	{
15		$elem->ThrowException();
16	}
17}
18
19$arr = array(new Element(), new Element(), new Element());
20array_map(array('Element', 'CallBack'), $arr);
21
22echo "Done\n";
23?>
24--EXPECTF--
25
26Warning: array_map(): An error occurred while invoking the map callback in %s on line %d
27
28Fatal error: Uncaught exception 'Exception' in %s:%d
29Stack trace:
30#0 %s(%d): Element->ThrowException()
31#1 [internal function]: Element::CallBack(Object(Element))
32#2 %s(%d): array_map(Array, Array)
33#3 {main}
34  thrown in %s on line %d
35