Fixed bug #8191: IRRE - Storing data crashes somehow with MM tables
authorOliver Hader <oliver.hader@typo3.org>
Sat, 27 Feb 2010 15:17:33 +0000 (15:17 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Sat, 27 Feb 2010 15:17:33 +0000 (15:17 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-2@7065 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php

index b7887ee..2c72965 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-02-27  Oliver Hader  <oliver@typo3.org>
+
+       * Fixed bug #8191: IRRE - Storing data crashes somehow with MM tables (thanks to Peter Kuehn & Franz Koch)
+
 2010-02-24  Ernesto Baschny  <ernst@cron-it.de>
 
        * Fixed bug #13258: Make TYPO3 v4.2 work again with PHP 5.1 (was broke since the case since 4.2.11)
index cc6a91d..6012f2b 100755 (executable)
@@ -2395,6 +2395,11 @@ class t3lib_TCEmain      {
                                // update record in intermediate table (sorting & pointer uid to parent record)
                        $dbAnalysis->writeForeignField($tcaFieldConf, $id, 0, $skipSorting);
                        $newValue = ($keepTranslation ? 0 : $dbAnalysis->countItems(false));
+                       // IRRE with MM relation:
+               } else if ($this->getInlineFieldType($tcaFieldConf) == 'mm') {
+                               // in order to fully support all the MM stuff, directly call checkValue_group_select_processDBdata instead of repeating the needed code here
+                       $valueArray = $this->checkValue_group_select_processDBdata($valueArray, $tcaFieldConf, $id, $status, 'select', $table, $field);
+                       $newValue = ($keepTranslation ? 0 : $valueArray[0]);
                        // IRRE with comma separated values:
                } else {
                        $valueArray = $dbAnalysis->getValueArray();
@@ -6354,7 +6359,10 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
        function dbAnalysisStoreExec()  {
                reset($this->dbAnalysisStore);
                while(list($k,$v)=each($this->dbAnalysisStore)) {
-                       $id = t3lib_BEfunc::wsMapId($v[4],$this->substNEWwithIDs[$v[2]]);
+                       $id = t3lib_BEfunc::wsMapId(
+                               $v[4],
+                               (t3lib_div::testInt($v[2]) ? $v[2] : $this->substNEWwithIDs[$v[2]])
+                       );
                        if ($id)        {
                                $v[2] = $id;
                                $v[0]->writeMM($v[1],$v[2],$v[3]);