Skip to content

Commit 28d4622

Browse files
[BUGFIX] Initialize properties in AbstractController depending on application context (#1640)
Co-authored-by: Sebastian Meyer <[email protected]>
1 parent 6ae55c4 commit 28d4622

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Classes/Controller/AbstractController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Psr\Log\LoggerAwareInterface;
2121
use Psr\Log\LoggerAwareTrait;
2222
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
23+
use TYPO3\CMS\Core\Information\Typo3Version;
2324
use TYPO3\CMS\Core\Localization\LanguageService;
2425
use TYPO3\CMS\Core\Log\LogManager;
2526
use TYPO3\CMS\Core\Pagination\PaginationInterface;
@@ -124,6 +125,12 @@ protected function initialize(RequestInterface $request): void
124125
$this->pageUid = (int) GeneralUtility::_GET('id');
125126
$this->requestData['page'] = $this->requestData['page'] ?? 1;
126127

128+
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() >= 12) {
129+
if ($request->getAttribute('applicationType') === 1) {
130+
$this->pageUid = $request->getAttribute('routing')->getPageId();
131+
}
132+
}
133+
127134
// Sanitize user input to prevent XSS attacks.
128135
$this->sanitizeRequestData();
129136

@@ -151,7 +158,6 @@ protected function initialize(RequestInterface $request): void
151158
} catch (InvalidFileException) {
152159
$this->logger->warning('Public resource path of the dlf extension could not be determined');
153160
}
154-
155161
}
156162

157163
/**

Tests/Functional/Api/OaiPmhTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function correctlyRespondsOnBadVerb()
110110
'verb' => 'nastyVerb',
111111
],
112112
]);
113+
113114
$xml = new SimpleXMLElement((string) $response->getBody());
114115

115116
self::assertEquals('badVerb', (string) $xml->error['code']);

0 commit comments

Comments
 (0)