xref: /PHP-8.2/Zend/tests/bug61025.phpt (revision fbbcf82a)
1--TEST--
2Bug #61025 (__invoke() visibility not honored)
3--FILE--
4<?php
5
6class Bar {
7    private function __invoke() {
8        return __CLASS__;
9    }
10}
11
12$b = new Bar;
13echo $b();
14
15echo $b->__invoke();
16
17?>
18--EXPECTF--
19Warning: The magic method Bar::__invoke() must have public visibility in %sbug61025.php on line %d
20Bar
21Fatal error: Uncaught Error: Call to private method Bar::__invoke() from global scope in %s:%d
22Stack trace:
23#0 {main}
24  thrown in %sbug61025.php on line %d
25