|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-08-14 08:24 UTC] nikic@php.net
[2020-08-14 08:24 UTC] nikic@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 03:00:01 2025 UTC |
Description: ------------ 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: --------------- <?php 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