[TYPO3-core] Bug 3552: Uninitialized array causes problems in PHP5

Bernhard Kraft kraftb at kraftb.at
Wed Aug 16 21:15:00 CEST 2006

Michael Stucki wrote:
> So please, can someone with a TV setup try to reproduce the old behaviour,
> then apply the patch, and report if this works?


I just encountered this bug again.

I tested this line now:

is_array($dataValues_current) && is_array($dataValues_current[$key]) && is_array($dataValues_current[$key]['el'][$ik]) && 
is_array($dataValues_current[$key]['el'][$ik][$theKey]) ? $dataValues_current[$key]['el'][$ik][$theKey]['el']:array(),

Instead of the previous simple usage of


and it works properly in both PHP4 and PHP5 ... Dmitrys better patch which fixes also other problems won't work on PHP4
cause parameters can't be passed by reference (&) and have a default value (= array()) at the same time there (in PHP4).

You can try this with a simple test script ...

function m($p1, &$p2 = array()) {
   echo $p1;
   $p2[1] = 3;

this does work well on PHP5 but not on 4 !

So I suggest to fix this problem like Ingmar proposed by adding a chain of is_array() statement's "diving" into the array structure.

We do not need to check the 'el' keys ... when the parent part is an array those key's will be set anyways (we could do it if we like
but then we could add an is_array() almost anywhere)

I would really like to see to get this into 4.0.2 together with other nice patches from the T3DD like the AJAX pagetree ....

"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
[[ http://think-open.at | Open source company ]]

More information about the TYPO3-team-core mailing list