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

Helmut Hummel helmut at typo3.org
Mon Apr 5 18:02:53 CEST 2010


Hi Jochen,

Am 03.04.10 21:05, schrieb Jochen Rau:
> 
> On 03.04.10 18:52, Helmut Hummel wrote:
>>
>> So there's only one question remaining, why the core autoloader logs
>> error messages despite there might be other registered spl autoloaders
>> which could handle (auto)loading those classes.
> 
> I stumbled upon that behavior, too. Logging only makes sense if it
> doesn't flood the Log. In case of Extbase related extensions it's
> totally useless, because Extbase takes care of the autoloading.
> 
> Unfortunately, the logging "feature" is hardcoded:
> 
> if (!class_exists($className, false) && !interface_exists($className,
> false)) {
>     self::logLoadingFailure($className);
> }

Yeah, that's the (bad) point.

> in t3lib_autoloader. I suggest to make it configurable and to diable it
> by default.

This is one option. Another would be to disable the logging in this
place and register the logging function with spl_autoload_register at a
later point, after all the ext_localconf.php are processed...

<minutes of writing a patch>

... but well, in extbase, the autoloader is registered in the
dispatcher, so it is done just before rendering the plugin. This is
indeed _very_ late, no chance to register the error logging after that
point.

OK, I could write a wrapper function for t3lib_autoloader, to register a
custom autoloader:

static public function registerCustomAutoloader($methodName) {
	spl_autoload_unregister('t3lib_autoloader::logLoadingFailure');
	$isRegistered =  spl_autoload_register($methodName);
	spl_autoload_register('t3lib_autoloader::logLoadingFailure');
	return $isRegistered;
}

But this looks a bit like an overkill.

Hm, any other ideas?

> BTW the same logging issue is with the deprecationLog. It's configurabel
> but enabled by default. So, the log is flooded by "old" extensions and
> slows down, the page generation significantly.

I feel a bit different about this one, but since I think we should
deliver a production ready default configuration, it would indeed be
better to turn this off by default.

Regards Helmut




More information about the TYPO3-dev mailing list