$GLOBALS['TSFE']->page['title'] in USER doesn't work anymore for cached pages
Since commit 1263413f305a459080b895f762740bbfaeaca686 which fixed issue #54467, you can't correctly set the page title in a USER plugin anymore. The new call to regeneratePageTitle() unconditionally sets the page title based on the values of
page['title'] at the time of the request.
If the page title gets set from a USER plugin, those values are only correctly set for requests that aren't answered from the cache. All later requests that are answered from the cache don't execute the USER plugin, and therefore the new call to regenerateTitle() sets the page title to its "regular" value, overriding the value initially set by the USER plugin.
Updated by Markus Klein almost 9 years ago
This is really a tough thing.
Considering a partially cached page, we have the situation that the cached page parts might be having a USER plugin which sets a custom page title. So the content coming from the cache (in particular the restored PageRenderer) already contains the valid title. The subsequent call to PageGenerator::generatePageTitle() will overwrite those valid values with the "fresh" data from TSFE. But the data of TSFE are not preset with the data from the restored PageRenderer, hence the title is overridden.
If we remove the call to PageGenerator::generatePageTitle() would fix the issue, but then USER_INT plugins will not be able to set the page title, so we would be back to issue #54467.
The only solution can therefore be to either preset the TSFE data accordingly, or to double-buffer write actions to TSFE. Second is not possible, since the members are public and no setters are in place.