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