xref: /PHP-7.4/Zend/tests/bug39003.phpt (revision 782352c5)
1--TEST--
2Bug #39003 (__autoload() 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: Argument 1 passed to test() must be an instance of OtherClassName, instance of ClassName given, called in %s on line %d and defined in %s:%d
24Stack trace:
25#0 %s(%d): test(Object(ClassName))
26#1 {main}
27  thrown in %s on line %d
28