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

Bernhard Kraft kraftb at kraftb.at
Wed Jul 19 20:45:27 CEST 2006


Hello,

This is a CVS patch request
(my first since SVN - could anyone point me to a thread where it has been
discussed how to commit now (i know svn update/commit - just not if we have to
use special branches or whatever)

Bugtracker reference:
http://bugs.typo3.org/view.php?id=3552

Description:
When a new section get's added to a Flexform (doesn't matter if it was handcrafted
or made using the TV Flexform-Wizard (Mapper)) it doesn't get added to the flexform
XML in the database instantly.
It rather get's added when the first field's of this section-element get submitted
(meaning on next submit).
This causes a problem with PHP5. While the flexform-field get's checked by t3lib_tcemain
(function "checkValue") a problem get's caused while calling method "checkValue_flex_procInData_travDS"

Here in line 1950 an array-key is accessed which doesn't exist at this moment because
the flexform look still like:

<T3FlexForms>
    <data>
        <sheet index="sDEF">
            <language index="lDEF">
                <field index="field_section">
                    <el index="el">
                    </el>
                </field>
            </language>
        </sheet>
    </data>
</T3FlexForms>

from this code:
                  $this->checkValue_flex_procInData_travDS(
                      $dataValues[$key]['el'][$ik][$theKey]['el'],
                      $dataValues_current[$key]['el'][$ik][$theKey]['el'],
                      $uploadedFiles[$key]['el'][$ik][$theKey]['el'],
                      $DSelements[$key]['el'][$theKey]['el'],
                      $pParams,
                      $callBackFunc,
                      $structurePath.$key.'/el/'.$ik.'/'.$theKey.'/el/'
                    );

The third passed variable "$dataVAlues_current" is the flexform-xml array which got directly
fetched from the database. As I noticed before the values of the section-element will only be
available in $dataValues and not in the record fetched from DB.

This doesn't cause problems in PHP4 as the error:
"Fatal error: Cannot use string offset as an array in /home/www/cms/typo3_src-4.0/t3lib/class.t3lib_tcemain.php on line 1950"

Just get's skipped - the database get's filled with the appropriate values afterwards and the error won't
occur again.



Reproducability:
Create a simple flexform with a section. Add an section-element to a section empty before. Don't fill
in any values but just press "Save". It will only fail in PHP5



Solution:
Quite obvious. See the attached patch.




greets,
Bernhard
-- 
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------
[[ http://think-open.at | Open source company ]]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_bug3552.diff
Type: text/x-patch
Size: 680 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060719/f279b395/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060719/f279b395/attachment.pgp 


More information about the TYPO3-team-core mailing list