Project

General

Profile

Actions

Bug #54742

closed

Class autoloader messes up with interfaces

Added by Markus Kappe over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2014-01-04
Due date:
% Done:

50%

Estimated time:
0.50 h
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by Markus Kappe over 10 years ago

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.

Actions #2

Updated by Benni Mack over 9 years ago

  • 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.

Actions #3

Updated by Markus Kappe over 9 years ago

Haven't experienced this problem in 6.2. So I suppose you can close this ticket

Actions #4

Updated by Benni Mack over 9 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF