• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FluidTYPO3 / flux / 18564197260

16 Oct 2025 02:11PM UTC coverage: 92.662% (-0.08%) from 92.743%
18564197260

push

github

NamelessCoder
[BUGFIX] Correct various lookup attempts to find current record

Fixes mainly a problem with Flux in an INT uncached context where
the resolved request and therefore content object data was not the
expected one (returned page row from inside a content context).

This fixes that problem by more consistently handing over the request
to the lookup methods and using the content object data when it is
availble in the content object.

3 of 10 new or added lines in 1 file covered. (30.0%)

12 existing lines in 2 files now uncovered.

7084 of 7645 relevant lines covered (92.66%)

65.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/Classes/Utility/ContentObjectFetcher.php
1
<?php
2
namespace FluidTYPO3\Flux\Utility;
3

4
/*
5
 * This file is part of the FluidTYPO3/Flux project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use Psr\Http\Message\ServerRequestInterface;
12
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
13
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
14
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
15

16
class ContentObjectFetcher
17
{
18
    public static function resolve(
19
        ?ConfigurationManagerInterface $configurationManager = null,
20
        ?ServerRequestInterface $request = null
21
    ): ?ContentObjectRenderer {
22
        $contentObject = null;
14✔
23
        $request ??= $configurationManager !== null && method_exists($configurationManager, 'getRequest')
14✔
UNCOV
24
            ? $configurationManager->getRequest()
×
25
            : ($GLOBALS['TYPO3_REQUEST'] ?? null);
14✔
26

27
        if ($request) {
14✔
28
            $contentObject = static::resolveFromRequest($request);
14✔
29
        }
30

31
        if ($contentObject === null
14✔
32
            && $configurationManager !== null
14✔
33
            && method_exists($configurationManager, 'getContentObject')
14✔
34
        ) {
35
            $contentObject = $configurationManager->getContentObject();
10✔
36
        }
37

38
        return $contentObject;
14✔
39
    }
40

41
    protected static function resolveFromRequest(ServerRequestInterface $request): ?ContentObjectRenderer
42
    {
43
        if (($cObject = $request->getAttribute('currentContentObject')) instanceof ContentObjectRenderer) {
14✔
44
            return $cObject;
3✔
45
        }
46
        /** @var TypoScriptFrontendController $controller */
47
        $controller = $request->getAttribute('frontend.controller');
11✔
48
        return $controller instanceof TypoScriptFrontendController ? $controller->cObj : null;
11✔
49
    }
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc