php-src/Zend/tests/bug39003.phpt

28 lines
525 B
Plaintext
Raw Normal View History

--TEST--
Bug #39003 (autoloader is called for type hinting)
--FILE--
<?php
class ClassName
{
2020-02-03 21:52:20 +00:00
public $var = 'bla';
}
function test (OtherClassName $object) { }
2017-01-30 21:28:17 +00:00
spl_autoload_register(function ($class) {
var_dump("__autload($class)");
2017-01-30 21:28:17 +00:00
});
$obj = new ClassName;
test($obj);
echo "Done\n";
?>
2018-09-16 17:16:42 +00:00
--EXPECTF--
Fatal error: Uncaught TypeError: test(): Argument #1 ($object) must be of type OtherClassName, ClassName given, called in %s:%d
Stack trace:
#0 %s(%d): test(Object(ClassName))
#1 {main}
thrown in %s on line %d