Bug #93593

ImageResourceContentObject unusable in CLI mode because FormProtection using session data

Added by Lukas Speck over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
CLI
Target version:
-
Start date:
2021-02-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
cli, session,
Complexity:
Is Regression:
Sprint Focus:

Description

Using the ImageResourceContentObject (via Typoscript "renderObj = IMG_RESOURCE") in CLI does not reliably work because it generates proccessed images with FormProtection and FormProtection want to retrive a token with help of the session ID. The CLI has no session.

I found a workaround for the solr indexer by setting the context aspect "fileProcessing" with "deferProcessing" to false.

Discovered in v10.

The exception then thrown is this:

Uncaught TYPO3 Exception Argument 1 passed to TYPO3\CMS\Core\Session\Backend\DatabaseSessionBackend::update() must be of the type string, null given, called in /public/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php on line 1260
thrown in file /public/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php
in line 185

With this trace:

#0 /public/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php(1260): TYPO3\CMS\Core\Session\Backend\DatabaseSessionBackend->update(NULL, Array)
#1 /public/typo3/sysext/core/Classes/FormProtection/BackendFormProtection.php(133): TYPO3\CMS\Core\Authentication\AbstractUserAuthentication->setAndSaveSessionData('formProtectionS...', 'a1f7bdd1a9c2f8b...')
#2 /public/typo3/sysext/core/Classes/FormProtection/BackendFormProtection.php(120): TYPO3\CMS\Core\FormProtection\BackendFormProtection->persistSessionToken()
#3 /public/typo3/sysext/core/Classes/FormProtection/AbstractFormProtection.php(50): TYPO3\CMS\Core\FormProtection\BackendFormProtection->retrieveSessionToken()
#4 /public/typo3/sysext/core/Classes/FormProtection/AbstractFormProtection.php(91): TYPO3\CMS\Core\FormProtection\AbstractFormProtection->getSessionToken()
#5 /public/typo3/sysext/backend/Classes/Routing/UriBuilder.php(118): TYPO3\CMS\Core\FormProtection\AbstractFormProtection->generateToken('route', 'image_processin...')
#6 /public/typo3/sysext/backend/Classes/Resource/Processing/DeferredBackendImageProcessor.php(61): TYPO3\CMS\Backend\Routing\UriBuilder->buildUriFromRoute('image_processin...', Array)
#7 /public/typo3/sysext/core/Classes/Resource/Service/FileProcessingService.php(149): TYPO3\CMS\Backend\Resource\Processing\DeferredBackendImageProcessor->processTask(Object(TYPO3\CMS\Core\Resource\Processing\ImageCropScaleMaskTask))
#8 /public/typo3/sysext/core/Classes/Resource/Service/FileProcessingService.php(122): TYPO3\CMS\Core\Resource\Service\FileProcessingService->process(Object(TYPO3\CMS\Core\Resource\ProcessedFile), Object(TYPO3\CMS\Core\Resource\ResourceStorage))
#9 /public/typo3/sysext/core/Classes/Resource/ResourceStorage.php(1448): TYPO3\CMS\Core\Resource\Service\FileProcessingService->processFile(Object(TYPO3\CMS\Core\Resource\File), Object(TYPO3\CMS\Core\Resource\ResourceStorage), 'Image.CropScale...', Array)
#10 /public/typo3/sysext/core/Classes/Resource/File.php(270): TYPO3\CMS\Core\Resource\ResourceStorage->processFile(Object(TYPO3\CMS\Core\Resource\File), 'Image.CropScale...', Array)
#11 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(4432): TYPO3\CMS\Core\Resource\File->process('Image.CropScale...', Array)
#12 /public/typo3/sysext/frontend/Classes/ContentObject/ImageResourceContentObject.php(32): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->getImgResource('1:/Bilder_und_D...', Array)
#13 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(822): TYPO3\CMS\Frontend\ContentObject\ImageResourceContentObject->render(Array)
#14 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(736): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->render(Object(TYPO3\CMS\Frontend\ContentObject\ImageResourceContentObject), Array)
#15 /public/typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php(84): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle('IMG_RESOURCE', Array, 'renderObj')
#16 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(822): TYPO3\CMS\Frontend\ContentObject\FilesContentObject->render(Array)
#17 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(736): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->render(Object(TYPO3\CMS\Frontend\ContentObject\FilesContentObject), Array)
#18 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(1874): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle('FILES', Array, '/stdWrap/.cObje...')
#19 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(1687): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->stdWrap_cObject('', Array)
#20 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(1666): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->stdWrap('', Array)
#21 /public/typo3/sysext/frontend/Classes/ContentObject/TextContentObject.php(44): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->stdWrap('', Array)
#22 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(822): TYPO3\CMS\Frontend\ContentObject\TextContentObject->render(Array)
#23 /public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(736): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->render(Object(TYPO3\CMS\Frontend\ContentObject\TextContentObject), Array)
#24 /public/typo3conf/ext/solr/Classes/IndexQueue/AbstractIndexer.php(156): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle('TEXT', Array)
#25 /public/typo3conf/ext/solr/Classes/IndexQueue/AbstractIndexer.php(93): ApacheSolrForTypo3\Solr\IndexQueue\AbstractIndexer->resolveFieldValue(Array, 'image_stringS', Array)
#26 /public/typo3conf/ext/solr/Classes/IndexQueue/Indexer.php(361): ApacheSolrForTypo3\Solr\IndexQueue\AbstractIndexer->addDocumentFieldsFromTyposcript(Object(ApacheSolrForTypo3\Solr\System\Solr\Document\Document), Array, Array)
#27 /public/typo3conf/ext/solr/Classes/IndexQueue/Indexer.php(177): ApacheSolrForTypo3\Solr\IndexQueue\Indexer->itemToDocument(Object(ApacheSolrForTypo3\Solr\IndexQueue\Item), 0)
#28 /public/typo3conf/ext/solr/Classes/IndexQueue/Indexer.php(149): ApacheSolrForTypo3\Solr\IndexQueue\Indexer->indexItem(Object(ApacheSolrForTypo3\Solr\IndexQueue\Item), 0)
#29 /public/typo3conf/ext/solr/Classes/Domain/Index/IndexService.php(205): ApacheSolrForTypo3\Solr\IndexQueue\Indexer->index(Object(ApacheSolrForTypo3\Solr\IndexQueue\Item))
#30 /public/typo3conf/ext/solr/Classes/Domain/Index/IndexService.php(131): ApacheSolrForTypo3\Solr\Domain\Index\IndexService->indexItem(Object(ApacheSolrForTypo3\Solr\IndexQueue\Item), Object(ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration))
#31 /public/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php(72): ApacheSolrForTypo3\Solr\Domain\Index\IndexService->indexItems(2000)
#32 /public/typo3/sysext/scheduler/Classes/Scheduler.php(182): ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask->execute()
#33 /public/typo3/sysext/scheduler/Classes/Command/SchedulerCommand.php(259): TYPO3\CMS\Scheduler\Scheduler->executeTask(Object(ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask))
#34 /public/typo3/sysext/scheduler/Classes/Command/SchedulerCommand.php(190): TYPO3\CMS\Scheduler\Command\SchedulerCommand->executeOrStopTask(Object(ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask))
#35 /public/typo3/sysext/scheduler/Classes/Command/SchedulerCommand.php(119): TYPO3\CMS\Scheduler\Command\SchedulerCommand->loopTasks()
#36 /vendor/symfony/console/Command/Command.php(255): TYPO3\CMS\Scheduler\Command\SchedulerCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 /vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#38 /vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand(Object(TYPO3\CMS\Scheduler\Command\SchedulerCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /public/typo3/sysext/core/Classes/Console/CommandApplication.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#41 /public/typo3/sysext/core/bin/typo3(23): TYPO3\CMS\Core\Console\CommandApplication->run()
#42 /public/typo3/sysext/core/bin/typo3(24): {closure}()
#43 {main} - {"TYPO3_MODE":"BE","exception":{}}

No data to display

Also available in: Atom PDF