[TYPO3-dev] Behavior of the core autoloader in TYPO3 versions 4.3.0 and above

Helmut Hummel helmut at typo3.org
Sat Apr 3 14:42:35 CEST 2010


Hi,

while developing an extension which comes with an own (please don't ask
why, this is really necessary in my case) autoloading mechanism (like
extbase also does), I stumbled over the implementation of the core
autoloader.

The core autoloader is registerd in a very early phase so that it is
triggered before any autoloader implementation which is registered by an
extension (which is generally good).

But what it does, when loading classes that are not in the autoloading
registry:

1. Lookup the registry for an entry of the to be loaded classname, which
fails (naturally).
2. Calling spl_autoload($className), which fails.
3. Log to syslog and (if active) the devlog, that autoloading failed.


What I'm asking myself now is:

1. Why is the spl_autoload called at all?
>From my understanding it "only" looks for matching class files in the
php include_path. The matching pattern is <className>.php

I don't see why this is necessary or usefull.

2. Since php/spl comes with a autoloading _stack_ I don't understand why
the first iplementation (see above) logs that no class was found, while
the other implementations will be called after that and will probably be
able to resolve and autoload the classes in question.


The current behaviour result in flooding the log with "Unable to load
class ..." messages (even from extbase/fluid classes), while everything
works just fine.


Do I miss something? Thanks.


Regards Helmut




More information about the TYPO3-dev mailing list