Bug #82528


SYS_LASTCHANGED value not being correctly set if RESTORE_REGISTER is used

Added by Presedo Roberto over 6 years ago. Updated about 1 month ago.

Must have
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


Each time TYPO3 renders a content element, it stores its timestamp value in SYS_LASTCHANGED in the REGISTER, keeping it warm until the end of the page rendering process
-> in \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::lastChanged

and then saving then value in the DB.
-> in \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::setSysLastChanged

If you use RESTORE_REGISTER cObject in your TS, it will reset the Register, setting it back to the previous values
-> in \TYPO3\CMS\Frontend\ContentObject\RestoreRegisterContentObject::render

So if RESTORE_REGISTER is used in a TYPOSCRIPT, the registered SYS_LASTCHANGED value is reset before being stored in the DB, so SYS_LASTCHANGED updates are may never be saved in DB.

SYS_LASTCHANGED temp value should not be set in Register in order to avoid it being reset.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #90827: If you edit the page content element, the "Last Mod." does not change.Accepted2020-03-25

Actions #1

Updated by Susanne Moog over 6 years ago

  • Category set to TypoScript
Actions #2

Updated by Christian Forgács about 5 years ago

This bug still exists in TYPO3 9

Actions #3

Updated by Fabian Schöner about 5 years ago

This bug also exists in TYPO3 7.6.34.

Actions #4

Updated by Guillaume Germain about 4 years ago

  • Target version set to Candidate for patchlevel

This bug also exists in TYPO3 9.5.13.

There is a problem with the Introduction Package because the "bootstrap_package" extension uses "RESTORE_REGISTER" in lib.dynamicContent.

Actions #5

Updated by Guillaume Germain about 4 years ago

  • Category changed from TypoScript to Frontend

It concerns the TypoScriptFrontendController class.

Actions #6

Updated by Petra Neumann over 3 years ago

The problem still exists in TYPO3 v10.

If any RESTORE_REGISTER is called, the temp value for SYS_LASTCHANGED is gone. Since ext:fluid_styled_content suggests using RESTORE_REGISTER for inserting content in the page template based on FLUIDTEMPLATE (see lib.dynamicContent), a lot of site-package extensions make use of it (like the bootstrap package). So in many TYPO3 installations SYS_LASTCHANGED is only updated for changes of the page properties but not the page content. This might be a problem, since the ContentObjectRenderer.php reads "The SYS_LASTCHANGED timestamp can be used by various caching/indexing applications to determine if the page has new content." - which will not work as intended then. Also, some sites use SYS_LASTCHANGED to show a "Last Updated on ...", even though it is not intended for that originally - this also fails with the value not being written correctly.

Actions #7

Updated by Reindl Bernd almost 3 years ago

If 'SYS_LASTCHANGED' is stored outside the $register variable, it's no longer available via 'data = register:SYS_LASTCHANGED' in TypoScript.

Quick solution:

public function render($conf = []) {
$SYS_LASTCHANGED = isset($GLOBALS['TSFE']->register['SYS_LASTCHANGED']) ? $GLOBALS['TSFE']->register['SYS_LASTCHANGED'] : false;
$GLOBALS['TSFE']->register = array_pop($GLOBALS['TSFE']->registerStack);
if($SYS_LASTCHANGED !== false)
return '';

So 'SYS_LASTCHANGED' is still available in register but is not restored when RESTORE_REGISTER is called.

Actions #8

Updated by Daniel Lorenz almost 3 years ago

  • TYPO3 Version changed from 8 to 10

We have been able to successfully test this change in a current TYPO3 v10.4.

Actions #9

Updated by Simon Gilli over 2 years ago

  • Related to Bug #90827: If you edit the page content element, the "Last Mod." does not change. added
Actions #10

Updated by Anonymous over 2 years ago

Daniel Lorenz wrote in #note-8:

We have been able to successfully test this change in a current TYPO3 v10.4.

We have the same problem. Especially with indexed_search which does not recognize changes to the page content.

Quickfix successfully tested under 10.4

Actions #11

Updated by Sebastian Schmal about 2 years ago

  • TYPO3 Version changed from 10 to 11
  • PHP Version changed from 7.0 to 7.4

same problem with the ext:seo (TYPO3 11.x)


'lastMod' => (int)($page['SYS_LASTCHANGED'] ?: $page['tstamp']),

but the field "SYS_LASTCHANGED" have a old timestamp in the DB.

the field "tstamp" is right, but the ext:seo take the SYS_LASTCHANGED

Yes, it update the page, like this (only updated in the frontend), but why?

Actions #12

Updated by Oliver Pfaff about 1 month ago

This seems still a thing. Here a new Patchfile for TYPO3 11, it uses the same solution from Reindl Bernd but avoids the usage of the $GLOBALS like the implementation in V11

Probably the bug is still inside v12 as well, i didn't test this. RestoreRegisterContentObject in v12 is the same as in v11 but maybe a different or better solution was found.


Also available in: Atom PDF