Commit 419e9ed2 authored by Chris Müller's avatar Chris Müller Committed by Christian Kuhn
Browse files

[BUGFIX] Avoid undefined array key error when copying record

This happens when "transOrigPointerField" is not defined in TCA configuration.

Additionally, a PHP 8.1 deprecation is fixed when passing a null to trim().

Resolves: #96514
Releases: main, 11.5
Change-Id: Ic99bd0b0c166397bda23d2e45ca2d4cb766000be
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72970

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5787565b
......@@ -2524,7 +2524,7 @@ class DataHandler implements LoggerAwareInterface
foreach ($evalArray as $func) {
switch ($func) {
case 'trim':
$value = trim($value);
$value = trim((string)$value);
break;
case 'required':
if (!$value) {
......@@ -3340,7 +3340,9 @@ class DataHandler implements LoggerAwareInterface
unset($copyTCE);
if (!$ignoreLocalization && $language == 0) {
//repointing the new translation records to the parent record we just created
$overrideValues[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] = $theNewSQLID;
if (isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])) {
$overrideValues[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] = $theNewSQLID;
}
if (isset($GLOBALS['TCA'][$table]['ctrl']['translationSource'])) {
$overrideValues[$GLOBALS['TCA'][$table]['ctrl']['translationSource']] = 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment