[TYPO3-dev] Extensions need update for 4.3!

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Oct 9 15:22:59 CEST 2008


Steffen Kamper wrote: on 09.10.2008 09:39:

> many extensions using substituteMarkerArrayCached will fail in 4.3 as
> the function changed. now all arguments has to be an array, otherwise
> you get following error:
> 
> Catchable fatal error: Argument [2,3,4] passed to
> tslib_cObj::substituteMarkerArrayCached() must be an array, null given
> 
> Best is to initialize the vars with empty array.

In this particular case I would suggest to change the type hinting to
allow for the "NULL" value also. This will keep the type hinting, but
will avoid all the backwards-compatibility issue with extensions that
did not initialize the $markers or $subparts array. It will break
extensions that set $markers to an integer or string, thou.

Lots of extensions do stuff like:

function doit($template) {
	if (blabla)
		$marker['###TEST###'] = 'value';

	$this->cObj->substituteMarkerArrayCached($template, $marker);
	...
}

So $marker will be uninitialized and PHP5 will say "Catchable fatal
error" when TYPO3 4.3's substituteMarkerArrayCached is called.

If we instead had:

public function substituteMarkerArrayCached($content, array
$markContentArray = NULL, ...)

(note the "= NULL" instead of "= array()") that previous call would be
"legal" (see [1]) and we would have to check for "is_null()" (which is
fast, AFAIK).

We still have the checks anyway, like:

                if (!is_array($markContentArray))
$markContentArray=array();      // Plain markers

which doesn't match with us enforcing arrays anyway.

Cheers,
Ernesto

[1] http://www.php.net/language.oop5.typehinting




More information about the TYPO3-dev mailing list