[BUGFIX] Avoid PHP notice in DataHandler 48/60348/7
authorMarkus Klein <markus.klein@typo3.org>
Wed, 27 Mar 2019 16:12:21 +0000 (17:12 +0100)
committerDaniel Goerz <daniel.goerz@posteo.de>
Wed, 3 Apr 2019 14:24:09 +0000 (16:24 +0200)
The fifth parameter to Datahandler::insertDB() is used in one place
without properly checking for the existence of the array element.
In general this parameter is only used for imp/exp extension
and works for admins only.

Resolves: #88025
Releases: master, 9.5
Change-Id: Iba5656857b1b16fb601a3c6af424a6477edc6956
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60348
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 160b584..05d05ee 100644 (file)
@@ -1114,7 +1114,7 @@ class DataHandler implements LoggerAwareInterface
                             $newVersion_placeholderFieldArray['t3ver_wsid'] = $this->BE_USER->workspace;
                             $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['label']] = $this->getPlaceholderTitleForTableLabel($table);
                             // Saving placeholder as 'original'
-                            $this->insertDB($table, $id, $newVersion_placeholderFieldArray, false, $incomingFieldArray['uid'] ?? 0);
+                            $this->insertDB($table, $id, $newVersion_placeholderFieldArray, false, (int)($incomingFieldArray['uid'] ?? 0));
                             // For the actual new offline version, set versioning values to point to placeholder:
                             $fieldArray['pid'] = -1;
                             $fieldArray['t3ver_oid'] = $this->substNEWwithIDs[$id];
@@ -1131,7 +1131,7 @@ class DataHandler implements LoggerAwareInterface
                                 $this->autoVersionIdMap[$table][$this->substNEWwithIDs[$id]] = $phShadowId;
                             }
                         } else {
-                            $this->insertDB($table, $id, $fieldArray, false, $incomingFieldArray['uid']);
+                            $this->insertDB($table, $id, $fieldArray, false, (int)($incomingFieldArray['uid'] ?? 0));
                         }
                     } else {
                         if ($table === 'pages') {