Bug #72224

problems introduced by bugfix 44270

Added by Franz Holzinger over 6 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Frontend
Target version:
Start date:
2015-12-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I have found another error related to the patch for bug #44270.
If you have a $content parameter for substituteMarkerArrayCached which has no marker at all, then an empty result is given back. This is wrong. The full $content must be returned.
Do not store into the cache with substMarkerCache if the result of preg_match_all is 0 or FALSE or $usedMarkers is empty. This will solve this issue.

$storeArr['c'] = preg_split($regex, $content);
$storeArr['k'] = $keyList[0];
}
if (!empty($storeArr)) {
// Setting cache:
$this->substMarkerCache[$storeKey] = $storeArr;
// Storing the cached data:
$GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
$GLOBALS['TT']->setTSlogMessage('Parsing', 0);
}
}
} else {
// Unserializing
$storeArr = unserialize($storeArrDat);
// Setting cache:
$this->substMarkerCache[$storeKey] = $storeArr;

The $content must be returned without any change if no marker is inside of it.

if (
isset($storeArr['k'])
) {
$content = '';
// Traversing the keyList array and merging the static and dynamic content
foreach ($storeArr['k'] as $n => $keyN) {
$content .= $storeArr['c'][$n];
if (!is_array($valueArr[$keyN])) {
$content .= $valueArr[$keyN];
} else {
$content .= $valueArr[$keyN][intval($wSCA_reg[$keyN]) % 2];
$wSCA_reg[$keyN]++;
}
}
$content .= $storeArr['c'][count($storeArr['k'])];
$GLOBALS['TT']->pull();
}
return $content;
}

see
https://forge.typo3.org/issues/44270#change-289881


Related issues

Related to TYPO3 Core - Bug #44270: wrong result in substituteMarkerArrayCachedClosedFranz Holzinger2013-01-02

Actions
Related to TYPO3 Core - Bug #72252: substituteMarkerArrayCached not substitute $subpartContentArrayClosedMarkus Klein2015-12-15

Actions
#1

Updated by Markus Klein over 6 years ago

  • Category set to Frontend
  • Status changed from New to Accepted
  • Priority changed from Should have to Must have
  • Target version set to 7.6.1
#2

Updated by Markus Klein over 6 years ago

  • Status changed from Accepted to In Progress
#3

Updated by Gerrit Code Review over 6 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45255

#4

Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45256

#5

Updated by Markus Klein over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#6

Updated by Riccardo De Contardi almost 5 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF