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

Martin Kutschker masi-no at spam-typo3.org
Mon Aug 4 17:46:47 CEST 2008


Dmitry Dulepov [typo3] schrieb:
> Hi!
> 
> Martin Kutschker wrote:
>> Do you know what SPL is? It's a PHP extension that comes shipped by
>> default with PHP, just like "gd", "preg" or the various XML extension we
>> require.
> 
> It is not installed by default on my SuSE.

Sucker ;-)

Any way, it's easy to do itz like this:

function typo3_autoload() {
  ..
}

if (function_exists('spl_autoload_register')) {
  spl_autoload_register('typo3_autoload');
} else {
  function __autoload() {
    typo3_autoload();
  }
}

Happy?

> SPL is not the only framework that provides autoload and counting only
> SPL is not good.

Which one do you expect to be run together with TYPO3 that also defines
__autoload?

Masi

PS: Please note that Ingo pointed out that TYPO3 4.2 already throws SPL
exceptions. While I think that this can be changed quite easily it's
annoying to redefine such simple thinhgs just because SuSe cannot be
bothered to add a module that is meant to be included by default by the
PHP folks to its own "default list". Go and install that RPM.
But hey, let's be forward compatible again and use FLOW3's exceptions.


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