xref: /PHP-7.3/ext/standard/tests/array/bug30266.phpt (revision 610c7fbe)
1--TEST--
2Bug #30266 (Invalid opcode 137/1/8) and array_walk
3--FILE--
4<?php
5class testc
6{
7	public $b = "c";
8
9	function crash($val)
10	{
11		$this->b = $val;
12		throw new Exception("Error");
13	}
14}
15
16$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
17
18$myobj = new testc();
19
20function test($item2, $key, $userd)
21{
22	$userd->crash($item2);
23}
24
25try
26{
27	array_walk($fruits, 'test', $myobj);
28}
29catch(Exception $e)
30{
31	echo "Caught: " . $e->getMessage() . "\n";
32}
33?>
34===DONE===
35--EXPECT--
36Caught: Error
37===DONE===
38