Skip to content

Commit 92359ba

Browse files
committed
[BUGFIX] Bring back support for random hash base in TYPO3 v12
Accidentally removed within 4.1.1, but we still support TYPO3 v12
1 parent c961fea commit 92359ba

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

Classes/EventListener/EnrichPageCacheIdentifierParametersEventListener.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
*/
1616
class EnrichPageCacheIdentifierParametersEventListener
1717
{
18+
/** @phpstan-ignore-next-line @todo Remove this comment when support for TYPO3 v12 is dropped */
1819
public function __invoke(BeforePageCacheIdentifierIsHashedEvent $beforePageCacheIdentifierIsHashedEvent): void
1920
{
2021
if (!RouteService::routeHasT3ApiResourceEnhancerQueryParam()) {
2122
return;
2223
}
2324

25+
/** @phpstan-ignore-next-line @todo Remove this comment when support for TYPO3 v12 is dropped */
2426
$beforePageCacheIdentifierIsHashedEvent->setPageCacheIdentifierParameters([
27+
/** @phpstan-ignore-next-line @todo Remove this comment when support for TYPO3 v12 is dropped */
2528
...$beforePageCacheIdentifierIsHashedEvent->getPageCacheIdentifierParameters(),
2629
't3api_hash_base_random' => microtime(),
2730
]);

Classes/Hook/EnrichHashBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use SourceBroker\T3api\Service\RouteService;
88

9+
// @todo remove this class when support for TYPO3 v12 is dropped. For TYPO3 >= v13 \SourceBroker\T3api\EventListener\EnrichPageCacheIdentifierParametersEventListener is doing the same job.
910
class EnrichHashBase
1011
{
1112
/**

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"symfony/property-info": "^6.4 || ^7.0",
2828
"symfony/psr-http-message-bridge": "^6.4 || ^7.0",
2929
"symfony/routing": "^6.4 || ^7.0",
30-
"typo3/cms-core": "^13",
30+
"typo3/cms-core": "^12.4.16 || ^13.3",
3131
"typo3/cms-extbase": "^12.4.16 || ^13.3",
3232
"typo3/cms-frontend": "^12.4.16 || ^13.3"
3333
},

ext_emconf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'author' => 'Inscript Team',
99
'author_email' => '[email protected]',
1010
'state' => 'stable',
11-
'version' => '4.1.1',
11+
'version' => '4.1.2',
1212
'constraints' => [
1313
'depends' => [
1414
'php' => '8.1.0-8.3.99',

ext_localconf.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

33
/** @noinspection PhpFullyQualifiedNameUsageInspection */
4+
5+
use TYPO3\CMS\Core\Information\Typo3Version;
6+
47
defined('TYPO3') || die('Access denied.');
58

69
call_user_func(
@@ -118,6 +121,11 @@ static function () {
118121
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']['t3api_clearcache'] =
119122
\SourceBroker\T3api\Service\SerializerService::class . '->clearCache';
120123

124+
if ((new Typo3Version())->getMajorVersion() < 13) {
125+
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['createHashBase']['t3api']
126+
= \SourceBroker\T3api\Hook\EnrichHashBase::class.'->init';
127+
}
128+
121129
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['enhancers'][\SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::ENHANCER_NAME] = \SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::class;
122130

123131
// protects against "&cHash empty" error when `cacheHash.enforceValidation` is set to `true`

0 commit comments

Comments
 (0)