Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: FluidTYPO3\Flux\Service\RecordService::isBackendOrPreviewContext() fails when used in command line context #2172

Open
gardiner opened this issue Jul 24, 2024 · 1 comment

Comments

@gardiner
Copy link

gardiner commented Jul 24, 2024

I have checked that the bug exists in the dev-development branch
Yes

I have checked that there are no already open issues or recently closed issues about this bug
Yes

Describe the bug
When cloning pages from a command line command some flux hook eventually calls RecordService::isBackendOrPreviewContext(), which fails. The method itself calls ApplicationType::fromRequest() with the contents from $GLOBALS['TYPO3_REQUEST'], which is null when called from a command line command, causing it to fail with the message: TypeError: TYPO3\CMS\Core\Http\ApplicationType::fromRequest(): Argument #1 ($request) must be of type Psr\Http\Message\ServerRequestInterface, null given.

Relevant stack trace:

Stack trace:
#0 /var/www/html/vendor/fluidtypo3/flux/Classes/Service/RecordService.php(150): TYPO3\CMS\Core\Http\ApplicationType::fromRequest(NULL)
#1 /var/www/html/vendor/fluidtypo3/flux/Classes/Service/RecordService.php(63): FluidTYPO3\Flux\Service\RecordService->isBackendOrPreviewContext()
#2 /var/www/html/vendor/fluidtypo3/flux/Classes/Service/WorkspacesAwareRecordService.php(37): FluidTYPO3\Flux\Service\RecordService->getSingle('pages', '*', 29485)
#3 /var/www/html/vendor/fluidtypo3/flux/Classes/Provider/PageProvider.php(216): FluidTYPO3\Flux\Service\WorkspacesAwareRecordService->getSingle('pages', '*', 29485)
#4 /var/www/html/vendor/fluidtypo3/flux/Classes/Integration/HookSubscribers/DataHandlerSubscriber.php(79): FluidTYPO3\Flux\Provider\PageProvider->postProcessRecord('update', 29485, Array, Object(TYPO3\CMS\Core\DataHandling\DataHandler), Array)
#5 /var/www/html/vendor/typo3/cms-core/Classes/DataHandling/DataHandler.php(777): FluidTYPO3\Flux\Integration\HookSubscribers\DataHandlerSubscriber->processDatamap_afterDatabaseOperations('update', 'pages', 29485, Array, Object(TYPO3\CMS\Core\DataHandling\DataHandler))
#6 /var/www/html/vendor/typo3/cms-core/Classes/DataHandling/DataHandler.php(1169): TYPO3\CMS\Core\DataHandling\DataHandler->hook_processDatamap_afterDatabaseOperations(Array, 'update', 'pages', 29485, Array)
#7 /var/www/html/vendor/typo3/cms-core/Classes/DataHandling/DataHandler.php(3585): TYPO3\CMS\Core\DataHandling\DataHandler->process_datamap()
#8 /var/www/html/packages/tz_site_generator/Classes/Service/Records/DataHandlerService.php(160): TYPO3\CMS\Core\DataHandling\DataHandler->process_cmdmap()

To Reproduce
Steps to reproduce the behavior:

  1. Call a typo3/symfony command line command which attempts to clone a page tree
  2. See error

Expected behavior
In previous versions (9.x) of Flux the cloning worked without a problem.

Thanks for your help, it is greatly appreciated!

Cheers,
Ole.

@dacostafilipe
Copy link

I'm having the same error when running typo3 cleanup:missingrelations

  • Typo3 12.4.8
  • PHP 8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants