xref: /PHP-8.0/Zend/tests/bug39003.phpt (revision 960318ed)
1--TEST--
2Bug #39003 (autoloader is called for type hinting)
3--FILE--
4<?php
5
6class ClassName
7{
8    public $var = 'bla';
9}
10
11function test (OtherClassName $object) { }
12
13spl_autoload_register(function ($class) {
14    var_dump("__autload($class)");
15});
16
17$obj = new ClassName;
18test($obj);
19
20echo "Done\n";
21?>
22--EXPECTF--
23Fatal error: Uncaught TypeError: test(): Argument #1 ($object) must be of type OtherClassName, ClassName given, called in %s:%d
24Stack trace:
25#0 %s(%d): test(Object(ClassName))
26#1 {main}
27  thrown in %s on line %d
28