xref: /PHP-7.0/ext/standard/tests/array/bug35821.phpt (revision 3ae995f0)
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
26Fatal error: Uncaught Exception in %s:%d
27Stack trace:
28#0 %s(%d): Element->ThrowException()
29#1 [internal function]: Element::CallBack(Object(Element))
30#2 %s(%d): array_map(Array, Array)
31#3 {main}
32  thrown in %s on line %d
33