Commit ddc5d1f8 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/+/72981

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 77e2740e
...@@ -2524,7 +2524,7 @@ class DataHandler implements LoggerAwareInterface ...@@ -2524,7 +2524,7 @@ class DataHandler implements LoggerAwareInterface
foreach ($evalArray as $func) { foreach ($evalArray as $func) {
switch ($func) { switch ($func) {
case 'trim': case 'trim':
$value = trim($value); $value = trim((string)$value);
break; break;
case 'required': case 'required':
if (!$value) { if (!$value) {
...@@ -3345,7 +3345,9 @@ class DataHandler implements LoggerAwareInterface ...@@ -3345,7 +3345,9 @@ class DataHandler implements LoggerAwareInterface
unset($copyTCE); unset($copyTCE);
if (!$ignoreLocalization && $language == 0) { if (!$ignoreLocalization && $language == 0) {
//repointing the new translation records to the parent record we just created //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'])) { if (isset($GLOBALS['TCA'][$table]['ctrl']['translationSource'])) {
$overrideValues[$GLOBALS['TCA'][$table]['ctrl']['translationSource']] = 0; $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