Bug #54742
closed
Class autoloader messes up with interfaces
Added by Markus Kappe almost 11 years ago.
Updated almost 10 years ago.
Description
I get this error:
PHP Warning: spl_autoload(): Unable to access t3lib_singleton.inc in /var/www/.../typo3_src-6.0.12/typo3/sysext/core/Classes/Core/ClassLoader.php on line 161
when I execute the scheduler.
Investigating the code I noticed, that ClassLoader::autoload() has the line
if ($classPath && !class_exists($realClassName, FALSE)) { ... }
while I believe the code should be
if ($classPath && !class_exists($realClassName, FALSE) && !interface_exists ($realClassName, FALSE)) { ... }
since t3lib_singleton is an interface and no class.
Maybe I don't understand what ClassLoader::autoload() should do - but I think there is another problem with this function. Here comes the original code:
if ($classPath && !class_exists($realClassName, FALSE) && !interface_exists ($realClassName, FALSE)) {
static::requireClassFileOnce($classPath, $className);
try {
if (preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $className)) {
spl_autoload($className);
}
} catch (\LogicException $exception) {
}
}
I think there should be another check for class_exists (or interface_exists) between requireClassFileOnce() and spl_autoload(). Otherwise I get
PHP Warning: spl_autoload(): Unable to access ....
although the class is properly loaded.
- Status changed from New to Needs Feedback
- Assignee set to Benni Mack
Does this problem still occur? Otherwise I will close the ticket in a few days.
Haven't experienced this problem in 6.2. So I suppose you can close this ticket
- Status changed from Needs Feedback to Closed
Also available in: Atom
PDF