[TYPO3-project-4-3] autoloader using SPL

Martin Kutschker masi-no at spam-typo3.org
Mon Aug 4 12:36:36 CEST 2008


Ingo Renner schrieb:
> Martin Kutschker wrote:
> 
> Hi Masi,
> 
>>>> I just noticed that the SPL extension has a stackable autoloader. I
>>>> suggest we use this for t3lib, tslib and possibly typo3/classes instead
>>>> of writing our own __autoload(). We could but we would clash with all
>>>> other PHP5 autoload implementations and SPL is installed by default.
>>> why would we?
>>
>> Some extension could intergrate a 3rd party lib that implements an
>> __autoload function. But thinking again this lib would also break our
>> SPL implementation. OTOH if both TYPO3 and the 3rd party libs use the
>> SPL mech everything's alright. So SPL is safer than a plain __autoload()
>> implementation.
> 
> yeah, I now read through the docs of the SPL autoloader. Quit
> interesting and more compelling than the standard autoload as it even
> falls back to the standard loader.
> OTOH we shouldn't care for everything what people do in there extensions...

But it doesn't hurt us to use the SPL autoload registry but it might
make some folks happy.

>> Your solution is definitely more ambitious.
> 
> but should be doable. I actually think that it's not a big deal.

I didn't say you cannot do it. It's more or less a grep for "^class
([a-zA-Z0-9_]+) {"  on all .php files.

The only caveat is that t3lib and typo3/classes don't live in the ext.
directories and must be handled in an extra run. And don't forget that
it is for some reason possible to define the location of tslib via
constants (start of index_ts.php), but I don't mind if that feature goes
away.

Masi


More information about the TYPO3-project-4-3 mailing list