Issue Bug Closed

#99307Extbase repository method call from command leads to "Undefined global variable $TYPO3_REQUEST"

Alex Kellner 12/07/22, 20:33 updated 02/08/23, 16:06

Description

Scenaria: Registered symfony command where an extbase repository is created via GeneralUtility::makeInstance(). Using something like $repository->findByUid(1) leads to this error:

PHP Warning: Undefined global variable $TYPO3_REQUEST in .../vendor/typo3/cms-extbase/Classes/Configuration/BackendConfigurationManager.php line 159

Exception trace:
  at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php:138
 TYPO3\CMS\Core\Error\ErrorHandler->handleError() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Configuration/BackendConfigurationManager.php:159
 TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager->getConfiguration() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Configuration/ConfigurationManager.php:100
 TYPO3\CMS\Extbase\Configuration\ConfigurationManager->getConfiguration() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Persistence/Generic/QueryFactory.php:62
 TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory->create() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Persistence/Generic/PersistenceManager.php:177
 TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager->createQueryForType() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Persistence/Generic/Backend.php:200
 TYPO3\CMS\Extbase\Persistence\Generic\Backend->getObjectByIdentifier() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Persistence/Generic/PersistenceManager.php:145
 TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager->getObjectByIdentifier() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Persistence/Repository.php:158
 TYPO3\CMS\Extbase\Persistence\Repository->findByIdentifier() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-extbase/Classes/Persistence/Repository.php:147
 TYPO3\CMS\Extbase\Persistence\Repository->findByUid() at /var/www/PhpstormProjects/luxletter/Classes/Command/QueueCommand.php:69
 In2code\Luxletter\Command\QueueCommand->execute() at /var/www/html/luxletter.localhost.de/vendor/symfony/console/Command/Command.php:312
 Symfony\Component\Console\Command\Command->run() at /var/www/html/luxletter.localhost.de/vendor/symfony/console/Application.php:1038
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/luxletter.localhost.de/vendor/symfony/console/Application.php:312
 Symfony\Component\Console\Application->doRun() at /var/www/html/luxletter.localhost.de/vendor/symfony/console/Application.php:168
 Symfony\Component\Console\Application->run() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-core/Classes/Console/CommandApplication.php:117
 TYPO3\CMS\Core\Console\CommandApplication->run() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-cli/typo3:23
 {closure}() at /var/www/html/luxletter.localhost.de/vendor/typo3/cms-cli/typo3:24
 include() at /var/www/html/luxletter.localhost.de/vendor/bin/typo3:120

Any breaking change here? TYPO3 12.1.0

Reviews 2