| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2010-07-28 14:15 UTC] johannes@php.net
 
-Status: Open
+Status: Bogus
  [2010-07-28 14:15 UTC] johannes@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
Description: ------------ If spl_autoload_register() is called from class method, SPL autoloader can use private and protected methods, although SPL is not a part of this class. It works well if spl_autoload_register() is called from somewhere else. Test script: --------------- <?php class CallbackTest { public function __construct() { spl_autoload_register(array($this, 'publicCallback')); spl_autoload_register(array($this, 'protectedCallback')); spl_autoload_register(array($this, 'privateCallback')); } public function publicCallback($className) { echo __METHOD__, "\n"; } protected function protectedCallback($className) { echo __METHOD__, "\n"; } private function privateCallback($className) { echo __METHOD__, "\n"; } } new CallbackTest(); new AutoloadTest(); Expected result: ---------------- PHP Fatal error: Uncaught exception 'LogicException' with message 'Passed array does not specify a callable method (cannot access protected method CallbackTest::protectedCallback())' in /home/binary/test.php:5 Stack trace: #0 test.php(5): spl_autoload_register(Array) #1 test.php(18): CallbackTest->__construct() #2 {main} thrown in test.php on line 5 Actual result: -------------- CallbackTest::publicCallback CallbackTest::protectedCallback CallbackTest::privateCallback PHP Fatal error: Class 'AutoloadTest' not found in test.php on line 19