[TYPO3-dev] CGL, t3lib_Singleton and PRE-4.3 compatibility

Stefan Geith typo3dev2008.nospam1 at geithware.de
Tue Jul 7 09:40:24 CEST 2009


Hi CGL-Authors,

Thanks for this work !

But I have one question concerning Singletons:

If I use t3lib_Singleton, then my plugin will only
be compatible with Typo3 4.3+ ... right ?

What is best practice to keep my plugins 4.2 (and older)
compatible ?

Should I use
<snip>
   if (!class_exists(t3lib_Singleton)) {
     interface t3lib_Singleton {
     }
   }
</snip>

instead of
<snip>
   require_once(PATH_t3lib . 'interfaces/interface.t3lib_singleton.php');
</snip>

or should I implement my own static function getInstance() ?

Or maybe we could / should add the file
   interfaces/interface.t3lib_singleton.php
even to 4.0.x, 4.1.x and 4.2.x ?
It does not realy change functionality - singletons
simply don't work then before 4.3, but don't have
errors due to unexisting class-file ...

What do you think ?

/Stefan Geith




More information about the TYPO3-dev mailing list