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

Francois Suter fsu-lists at cobweb.ch
Wed Jul 8 09:24:59 CEST 2009


Hi,

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

Yes.

> 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>

I would use that. I agree that it's not very elegant, but it's simple.

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

I wouldn't, as it means you would not rely on t3lib_div::makeInstance 
anymore (and thus not benefit from any bug fixes or improvement). 
Furthermore this function would have to be packed somewhere, either in 
all your extensions or in one of them, but creating dependencies.

> 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 ...

I think this will never be accepted, because we try to avoid having 
extensions depend on patch-level releases.

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch




More information about the TYPO3-dev mailing list