1--TEST-- 2Bug #24658 (combo of typehint / reference causes crash) 3--FILE-- 4<?php 5class foo {} 6function no_typehint($a) { 7 var_dump($a); 8} 9function typehint(foo $a) { 10 var_dump($a); 11} 12function no_typehint_ref(&$a) { 13 var_dump($a); 14} 15function typehint_ref(foo &$a) { 16 var_dump($a); 17} 18$v = new foo(); 19$a = array(new foo(), 1, 2); 20no_typehint($v); 21typehint($v); 22no_typehint_ref($v); 23typehint_ref($v); 24echo "===no_typehint===\n"; 25array_walk($a, 'no_typehint'); 26echo "===no_typehint_ref===\n"; 27array_walk($a, 'no_typehint_ref'); 28echo "===typehint===\n"; 29array_walk($a, 'typehint'); 30echo "===typehint_ref===\n"; 31array_walk($a, 'typehint_ref'); 32?> 33--EXPECTF-- 34object(foo)#%d (0) { 35} 36object(foo)#%d (0) { 37} 38object(foo)#%d (0) { 39} 40object(foo)#%d (0) { 41} 42===no_typehint=== 43object(foo)#%d (0) { 44} 45int(1) 46int(2) 47===no_typehint_ref=== 48object(foo)#%d (0) { 49} 50int(1) 51int(2) 52===typehint=== 53object(foo)#%d (0) { 54} 55 56Catchable fatal error: Argument 1 passed to typehint() must be an instance of foo, integer given in %s on line %d 57