Commit cd59f1c2 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Georg Ringer
Browse files

[BUGFIX] Ensure strings are passed to makeDiffDisplay()

In #97373 the makeDiffDisplay() method of
DiffUtility got type hinted. However, since
the corresponding usages were not adjusted,
this now led to type errors.

This is now fixed by applying proper typecasts.

Resolves: #97598
Related: #97373
Releases: main
Change-Id: I1593228df561e156cb8426db5743f1a63b2304f1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74586

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 47227c57
......@@ -350,8 +350,8 @@ class ElementHistoryController
if (is_array($GLOBALS['TCA'][$table]['columns'][$fN] ?? null) && ($GLOBALS['TCA'][$table]['columns'][$fN]['config']['type'] ?? '') !== 'passthrough') {
// Create diff-result:
$diffres = $diffUtility->makeDiffDisplay(
BackendUtility::getProcessedValue($table, $fN, ($entry['oldRecord'][$fN] ?? ''), 0, true),
BackendUtility::getProcessedValue($table, $fN, ($entry['newRecord'][$fN] ?? ''), 0, true)
(string)BackendUtility::getProcessedValue($table, $fN, ($entry['oldRecord'][$fN] ?? ''), 0, true),
(string)BackendUtility::getProcessedValue($table, $fN, ($entry['newRecord'][$fN] ?? ''), 0, true)
);
$rollbackUrl = '';
if ($rollbackUid) {
......
......@@ -66,8 +66,8 @@ class DefaultLanguageDifferences extends AbstractNode
$diffUtility = GeneralUtility::makeInstance(DiffUtility::class);
$diffUtility->stripTags = false;
$diffResult = $diffUtility->makeDiffDisplay(
BackendUtility::getProcessedValue($table, $fieldName, $defaultLanguageDiffRow[$fieldName], 0, true),
BackendUtility::getProcessedValue($table, $fieldName, $defaultLanguageRow[$fieldName], 0, true)
(string)BackendUtility::getProcessedValue($table, $fieldName, $defaultLanguageDiffRow[$fieldName], 0, true),
(string)BackendUtility::getProcessedValue($table, $fieldName, $defaultLanguageRow[$fieldName], 0, true)
);
$html[] = '<div class="t3-form-original-language-diff">';
$html[] = '<div class="t3-form-original-language-diffheader">';
......
......@@ -40,6 +40,6 @@ class DiffUtility
$str2 = strip_tags($str2);
}
$diff = new Diff(new Word());
return $diff->render((string)$str1, (string)$str2);
return $diff->render($str1, $str2);
}
}
......@@ -193,7 +193,7 @@ class RemoteServer
];
} elseif ($isNewOrDeletePlaceholder && isset($suitableFields[$fieldName])) {
// If this is a new or delete placeholder, add diff view for all appropriate fields
$newOrDeleteRecord[$fieldName] = BackendUtility::getProcessedValue(
$newOrDeleteRecord[$fieldName] = (string)BackendUtility::getProcessedValue(
$parameter->table,
$fieldName,
$liveRecord[$fieldName], // Both (live and version) values are the same
......@@ -201,7 +201,7 @@ class RemoteServer
true,
false,
$liveRecord['uid'] // Relations of new/delete placeholder do always contain the live uid
) ?? '';
);
// Don't add empty fields
if ($newOrDeleteRecord[$fieldName] === '') {
......@@ -233,7 +233,7 @@ class RemoteServer
false,
$liveRecord['uid']
);
$versionRecord[$fieldName] = BackendUtility::getProcessedValue(
$versionRecord[$fieldName] = (string)BackendUtility::getProcessedValue(
$parameter->table,
$fieldName,
$versionRecord[$fieldName],
......
......@@ -134,8 +134,8 @@ class HistoryService implements SingletonInterface
if (!empty($GLOBALS['TCA'][$tableName]['columns'][$field]['config']['type']) && $GLOBALS['TCA'][$tableName]['columns'][$field]['config']['type'] !== 'passthrough') {
// Create diff-result:
$fieldDifferences = $this->getDifferencesObject()->makeDiffDisplay(
BackendUtility::getProcessedValue($tableName, $field, $entry['oldRecord'][$field], 0, true),
BackendUtility::getProcessedValue($tableName, $field, $entry['newRecord'][$field], 0, true)
(string)BackendUtility::getProcessedValue($tableName, $field, $entry['oldRecord'][$field], 0, true),
(string)BackendUtility::getProcessedValue($tableName, $field, $entry['newRecord'][$field], 0, true)
);
if (!empty($fieldDifferences)) {
$differences[] = [
......
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