xref: /PHP-8.1/Zend/tests/bug65322.phpt (revision 7ce8c5ad)
1--TEST--
2Bug #65322: compile time errors won't trigger auto loading
3--FILE--
4<?php
5
6spl_autoload_register(function($class) {
7    var_dump($class);
8    class X {}
9});
10
11set_error_handler(function($_, $msg, $file) {
12    var_dump($msg, $file);
13    new X;
14});
15
16/* This is just a particular example of a non-fatal compile-time error
17 * If this breaks in future, just find another example and use it instead */
18eval('class A { private function __invoke() { } }');
19
20?>
21--EXPECTF--
22string(%d) "The magic method A::__invoke() must have public visibility"
23string(%d) "%s(%d) : eval()'d code"
24string(1) "X"
25