Edit report at https://bugs.php.net/bug.php?id=60955&edit=1
ID: 60955
Comment by: php-dev at zerocue dot com
Reported by: frederic dot hardy at mageekbox dot net
Summary: spl_autoload_register() accept a protected method
Status: Open
Type: Bug
Package: SPL related
Operating System: Linux
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
This report is requesting a change in the error output? It already doesn't
allow
the protected member to be registered as your actual result indicates, it
throws
an error.
What is this report about?
Previous Comments:
------------------------------------------------------------------------
[2012-02-02 14:02:59] frederic dot hardy at mageekbox dot net
Description:
------------
It's possible to register a protected method as an autoloader callback with the
function spl_autoload_register().
Test script:
---------------
<?php
class autoloader
{
function register()
{
spl_autoload_register(array($this, 'requireClass'));
}
protected function requireClass() {}
}
$autoloader = new autoloader();
$autoloader->register();
$autoloadFunctions = spl_autoload_functions();
foreach ($autoloadFunctions as $autoloadFunction)
{
spl_autoload_unregister($autoloadFunction);
}
foreach ($autoloadFunctions as $autoloadFunction)
{
spl_autoload_register($autoloadFunction);
}
Expected result:
----------------
Cannot register the protected method autoload::requireClass() as a callback
Actual result:
--------------
Passed array does not specify a callable method (cannot access protected method
autoloader::requireClass())
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60955&edit=1