Commit b883baac authored by Christian Kuhn's avatar Christian Kuhn Committed by Andreas Fernandez
Browse files

[BUGFIX] l10n_diffsource field can handle empty string and null value

Depending on DB platform, empty LOB fields can be returned
as NULL value (sqlite) or as empty string (mysql, our postgres
setup, mssql).

The patch adapts a minor detail in DataHandler since isset(null)
is false, but isset('') is true, it uses an array_key_exists()
instead for diff check on transOrigDiffSourceField / l10n_diffsource
field to align these two possible different db return values.

Resolves: #85186
Releases: master
Change-Id: I56c87fa519a0c787515eff403d48ac84e513300d
Reviewed-on: https://review.typo3.org/57149


Reviewed-by: Daniel Siepmann's avatarDaniel Siepmann <daniel.siepmann@typo3.org>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Tested-by: Daniel Siepmann's avatarDaniel Siepmann <daniel.siepmann@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 06551021
......@@ -1464,7 +1464,8 @@ class DataHandler implements LoggerAwareInterface
&& $GLOBALS['TCA'][$table]['ctrl']['languageField']
&& $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0
&& $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
&& (int)$currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] > 0) {
&& (int)$currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] > 0
) {
$originalLanguageRecord = $this->recordInfo($table, $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']], '*');
BackendUtility::workspaceOL($table, $originalLanguageRecord);
$originalLanguage_diffStorage = unserialize($currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']]);
......@@ -1568,7 +1569,9 @@ class DataHandler implements LoggerAwareInterface
}
// Add diff-storage information:
if ($diffStorageFlag && !isset($fieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']])) {
if ($diffStorageFlag
&& !array_key_exists($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField'], $fieldArray)
) {
// If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
$fieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
}
......
Supports Markdown
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