php-src/tests/lang/bug24658.phpt

57 lines
968 B
Plaintext
Raw Normal View History

2003-07-18 02:50:56 +08:00
--TEST--
Bug #24658 (combo of typehint / reference causes crash)
--FILE--
<?php
class foo {}
function no_typehint($a) {
var_dump($a);
}
function typehint(foo $a) {
var_dump($a);
}
function no_typehint_ref(&$a) {
var_dump($a);
}
function typehint_ref(foo &$a) {
var_dump($a);
}
$v = new foo();
$a = array(new foo(), 1, 2);
no_typehint($v);
typehint($v);
no_typehint_ref($v);
typehint_ref($v);
2003-08-17 02:28:20 +08:00
echo "===no_typehint===\n";
2003-07-18 02:50:56 +08:00
array_walk($a, 'no_typehint');
2003-08-17 02:28:20 +08:00
echo "===no_typehint_ref===\n";
2003-07-18 02:50:56 +08:00
array_walk($a, 'no_typehint_ref');
2003-08-17 02:28:20 +08:00
echo "===typehint===\n";
2003-07-18 02:50:56 +08:00
array_walk($a, 'typehint');
2003-08-17 02:28:20 +08:00
echo "===typehint_ref===\n";
2003-07-18 02:50:56 +08:00
array_walk($a, 'typehint_ref');
?>
--EXPECTF--
object(foo)#%d (0) {
}
object(foo)#%d (0) {
}
object(foo)#%d (0) {
}
object(foo)#%d (0) {
}
2003-08-17 02:28:20 +08:00
===no_typehint===
2003-07-18 02:50:56 +08:00
object(foo)#%d (0) {
}
int(1)
int(2)
2003-08-17 02:28:20 +08:00
===no_typehint_ref===
2003-07-18 02:50:56 +08:00
object(foo)#%d (0) {
}
int(1)
int(2)
2003-08-17 02:28:20 +08:00
===typehint===
object(foo)#%d (0) {
}
2003-07-18 02:50:56 +08:00
Fatal error: Argument 1 must be an object of class foo in %s on line %d