|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78770 Incorrect callability check inside internal methods
Submitted: 2019-11-01 15:53 UTC Modified: -
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.2.24 OS:
Private report: No CVE-ID: None
 [2019-11-01 15:53 UTC]
Due to the way zend_get_executed_scope() works, callability checks inside internal *methods* work different from internal *functions*. They will use the scope of the method itself, rather than the scope of the calling userland method.

The attached example uses an IntlChar method with "f" parameter to show the problem.

Test script:
class Test {
    public function method() {
        IntlChar::enumCharTypes([$this, 'privateMethod']);

    private function privateMethod($start, $end, $name) {

(new Test)->method();

Actual result:
Fatal error: Uncaught TypeError: IntlChar::enumCharTypes() expects parameter 1 to be a valid callback, cannot access private method Test::privateMethod() in /home/nikic/php-src/t074.php:5
Stack trace:
#0 /home/nikic/php-src/t074.php(5): IntlChar::enumCharTypes(Array)
#1 /home/nikic/php-src/t074.php(12): Test->method()
#2 {main}
  thrown in /home/nikic/php-src/t074.php on line 5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-14 08:24 UTC]
Automatic comment on behalf of
Log: Fix bug #78770
 [2020-08-14 08:24 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 13:01:33 2024 UTC