Update auf 6.6.20 schlägt fehl mit Fehler in EscaperExtension.php line 127

Ich habe einen Shopware 6 Onlineshop, der einwandfrei mit Version 6.5.8.7 läuft. Versuche ich diesen im Adminbereich mit Hilfe des Assistenten auf die 6.6.20 zu aktualisieren, wobei ich zuvor alle Extensions deaktiviert habe, schlägt die fast vollständige Aktualisierung fehl mit der Fehlermeldung

In EscaperExtension.php line 127:
                                                                               
  [LogicException]                                                             
  You must call "setEnvironment()" before calling "Twig\Extension\EscaperExte  
  nsion::setEscaper()". 

Ich kann mir leider keinen Reim auf diese kryptische Meldung machen. Liegt hier ein Fehler vor? Wie kann ich ihn korrigieren oder gibt es hierfür einen Workaround?

Ich betreibe Shopware bei Webgo. PHP Version 8.2.

Hier der relevante Ausschnitt aus dem Fehler-Log:

---------- ---------------------- 
  Action     Number of migrations  
 ---------- ---------------------- 
  Migrated   4 out of 4            
 ---------- ---------------------- 

all migrations for identifier: "core" executed
cleared the shopware cache

In EscaperExtension.php line 127:
                                                                               
  [LogicException]                                                             
  You must call "setEnvironment()" before calling "Twig\Extension\EscaperExte  
  nsion::setEscaper()".                                                        
                                                                               

Exception trace:
  at /home/www/shopware6_prod/vendor/twig/twig/src/Extension/EscaperExtension.php:127
 Twig\Extension\EscaperExtension->setEscaper() at /home/www/shopware6_prod/vendor/shopware/core/Content/Seo/SeoUrlTwigFactory.php:33
 Shopware\Core\Content\Seo\SeoUrlTwigFactory->createTwigEnvironment() at /home/www/shopware6_prod/var/cache/prod_h31a2b0820cc6ca42b0641457d7c31846/ContainerWxlzV8x/Shopware_Core_KernelProdContainer.php:24447
 ContainerWxlzV8x\Shopware_Core_KernelProdContainer::getSeoUrlGeneratorService() at /home/www/shopware6_prod/var/cache/prod_h31a2b0820cc6ca42b0641457d7c31846/ContainerWxlzV8x/Shopware_Core_KernelProdContainer.php:30227
 ContainerWxlzV8x\Shopware_Core_KernelProdContainer::getSeoUrlUpdateListenerService() at /home/www/shopware6_prod/var/cache/prod_h31a2b0820cc6ca42b0641457d7c31846/ContainerWxlzV8x/Shopware_Core_KernelProdContainer.php:11342
 ContainerWxlzV8x\Shopware_Core_KernelProdContainer::ContainerWxlzV8x\{closure}() at /home/www/shopware6_prod/vendor/symfony/event-dispatcher/EventDispatcher.php:243
 Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() at /home/www/shopware6_prod/vendor/symfony/event-dispatcher/EventDispatcher.php:206
 Symfony\Component\EventDispatcher\EventDispatcher->callListeners() at /home/www/shopware6_prod/vendor/symfony/event-dispatcher/EventDispatcher.php:56
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Content/Flow/Dispatching/FlowDispatcher.php:50
 Shopware\Core\Content\Flow\Dispatching\FlowDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Framework/Webhook/WebhookDispatcher.php:70
 Shopware\Core\Framework\Webhook\WebhookDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Framework/Event/NestedEventDispatcher.php:31
 Shopware\Core\Framework\Event\NestedEventDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Framework/DataAbstractionLayer/EntityRepository.php:109
 Shopware\Core\Framework\DataAbstractionLayer\EntityRepository->upsert() at /home/www/shopware6_prod/vendor/shopware/storefront/Theme/ThemeLifecycleService.php:92
 Shopware\Storefront\Theme\ThemeLifecycleService->refreshTheme() at /home/www/shopware6_prod/vendor/shopware/storefront/Theme/ThemeLifecycleService.php:60
 Shopware\Storefront\Theme\ThemeLifecycleService->refreshThemes() at /home/www/shopware6_prod/vendor/shopware/storefront/Theme/Subscriber/UpdateSubscriber.php:56
 Shopware\Storefront\Theme\Subscriber\UpdateSubscriber->updateFinished() at /home/www/shopware6_prod/vendor/symfony/event-dispatcher/EventDispatcher.php:246
 Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() at /home/www/shopware6_prod/vendor/symfony/event-dispatcher/EventDispatcher.php:206
 Symfony\Component\EventDispatcher\EventDispatcher->callListeners() at /home/www/shopware6_prod/vendor/symfony/event-dispatcher/EventDispatcher.php:56
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Content/Flow/Dispatching/FlowDispatcher.php:50
 Shopware\Core\Content\Flow\Dispatching\FlowDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Framework/Webhook/WebhookDispatcher.php:70
 Shopware\Core\Framework\Webhook\WebhookDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Framework/Event/NestedEventDispatcher.php:31
 Shopware\Core\Framework\Event\NestedEventDispatcher->dispatch() at /home/www/shopware6_prod/vendor/shopware/core/Maintenance/System/Command/SystemUpdateFinishCommand.php:88
 Shopware\Core\Maintenance\System\Command\SystemUpdateFinishCommand->execute() at /home/www/shopware6_prod/vendor/symfony/console/Command/Command.php:279
 Symfony\Component\Console\Command\Command->run() at /home/www/shopware6_prod/vendor/symfony/console/Application.php:1049
 Symfony\Component\Console\Application->doRunCommand() at /home/www/shopware6_prod/vendor/symfony/framework-bundle/Console/Application.php:125
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /home/www/shopware6_prod/vendor/symfony/console/Application.php:318
 Symfony\Component\Console\Application->doRun() at /home/www/shopware6_prod/vendor/symfony/framework-bundle/Console/Application.php:79
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/www/shopware6_prod/vendor/symfony/console/Application.php:169
 Symfony\Component\Console\Application->run() at /home/www/shopware6_prod/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /home/www/shopware6_prod/vendor/autoload_runtime.php:29
 require_once() at /home/www/shopware6_prod/bin/console:17

Viele Grüße
Philipp

Ich wollte eben einen ähnlichen Thread erstellen. Habe das Problem aber mit einer kompletten Neuinstallation :-/.

Neuer Server mit Ubuntu 22,xx und Plesk. Neuinstallation von Shopware

Ich bekomme den Fehler, wenn ich z.B. den Store aktivieren will. Interessanterweise ist kein Standard Theme nach der Installation hinterlegt. Neuinstallation brachte keine Abhilfe :male_detective:


[2024-05-11T19:15:38.253762+00:00] php.INFO: User Deprecated: Since twig/twig 3.10: The "Twig\Extension\EscaperExtension::setEscaper()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::setEscaper()" method instead (be warned that Environment is not passed anymore to the callable). {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since twig/twig 3.10: The \"Twig\\Extension\\EscaperExtension::setEscaper()\" method is deprecated, use the \"Twig\\Runtime\\EscaperRuntime::setEscaper()\" method instead (be warned that Environment is not passed anymore to the callable). at httpdocs/vendor/twig/twig/src/Extension/EscaperExtension.php:124)"} []
[2024-05-11T19:15:38.255554+00:00] request.CRITICAL: Uncaught PHP Exception LogicException: "You must call "setEnvironment()" before calling "Twig\Extension\EscaperExtension::setEscaper()"." at EscaperExtension.php line 127 {"exception":"[object] (LogicException(code: 0): You must call \"setEnvironment()\" before calling \"Twig\\Extension\\EscaperExtension::setEscaper()\". at httpdocs/vendor/twig/twig/src/Extension/EscaperExtension.php:127)"} []

Ich habe auch den Eindruck, dass es mit dem Store zusammenhängt. Nach dem (halb fehlgeschlagenen) Update gelang es mir jedenfalls auch nicht mehr den Store zu aktivieren, ich bekam da HTTP 500 bei den REST-Calls, wenn ich mich richtig erinnere.

Ich habe inzwischen einen Rollback vorgenommen auf die 6.5.8.7 (Restore aus Backup) und nun lässt sich der Store wieder aktivieren.

Hab bei mir composer installiert und eine Neuinstallation gemacht. Jetzt geht es.

Ob es daran lag, keine ahnung.

Vielen Dank für diese Idee. Ich habe bei mir auch versucht composer zu aktualisieren, bekomme hierbei jedoch leider eine Fehlermeldung

composer update

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Console/Helper/HelperSet.php on line 103
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/php/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Symfony\Component\Process\Process::getIterator($flags = 0) should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Process/Process.php:622
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Symfony\Component\Finder\Finder::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Finder.php:620
Deprecation Notice: Return type of Symfony\Component\Finder\Finder::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Finder.php:701
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FileTypeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php:42
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::getChildren() should either be compatible with RecursiveDirectoryIterator::getChildren(): RecursiveDirectoryIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:85
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::rewind() should either be compatible with FilesystemIterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:113
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::current() should either be compatible with FilesystemIterator::current(): SplFileInfo|FilesystemIterator|string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:61
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php:55
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::hasChildren() should either be compatible with RecursiveIterator::hasChildren(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php:74
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::getChildren() should either be compatible with RecursiveIterator::getChildren(): ?RecursiveIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php:79
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\DateRangeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php:41
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\PathFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/PathFilterIterator.php:27
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:777
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:782
Deprecation Notice: Return type of Composer\Repository\CompositeRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/CompositeRepository.php:180
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FilenameFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php:28
The "symfony/flex" plugin was skipped because it requires a Plugin API version ("^2.1") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
Loading composer repositories with package information
Deprecation Notice: Implicit conversion from float 204.57 to int loses precision in /usr/share/php/Composer/Platform/Version.php:100
Deprecation Notice: Return type of Composer\DependencyResolver\Pool::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Pool.php:76
Updating dependencies
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSet.php:116
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSet.php:101
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:155
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:165
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:160
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:170
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:150
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:145
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:36
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:46
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:41
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:89
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:70
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/DependencyResolver/Problem.php:308
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/framework-bundle[v6.4.0, ..., v6.4.7] require composer-runtime-api >=2.1 -> found composer-runtime-api[2.0.0] but it does not match the constraint.
    - shopware/storefront v6.5.8.7 requires symfony/framework-bundle ~6.4.0 -> satisfiable by symfony/framework-bundle[v6.4.0, ..., v6.4.7].
    - Root composer.json requires shopware/storefront 6.5.8.7 -> satisfiable by shopware/storefront[v6.5.8.7].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Ein Update mit --with-all-dependencies klappt irgendwie auch nicht. Hat jemand eine Idee, wie ich mein Composer wieder in Ordnung bringen kann?

Welche TWIG Version nutzt du.
Hatte gesterne in ähnliches Problem und da war die TWIG Version schuld!

Gute Neuigkeiten, ich habe das Upgrade nun auch erfolgreich nach composer Update hinbekommen. Hierzu musste ich zunächst composer lokal im Shopware6 Ordner installieren. Man kann wohl nicht davon ausgehen, dass beim Shared Webhosting die global installiere Composer Version „up-to-date“ ist. Daher auch die Fehlermeldungen im vorherigen Post von mir.

Ich bin hierbei der Anleitung unter Composer gefolgt (Hinweis: Stand von heute 13.5.24).

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Anschließend habe ich noch die composer.phar per mv composer.phar bin/ in den Shopware 6 bin Ordner verschoben.

Anschließend habe ich dann /bin/composer.phar update ausgeführt. Nun traten keine Fehlermeldungen mehr auf und offenbar wurde auch die veraltete TWIG Version in diesem Zuge aktualisiert. Diese ist nun die brandfrische v3.10.1 (vgl. Hinweis unten, aktuell darf es nur v3.8.x sein).

Abschließend habe ich dann wieder mit dem Update Assistenten im Shopware Admin Bereich das Upgrade auf die 6.6.20 durchgeführt. Und siehe an, es gab keine Fehlermeldungen mehr und lief alles durch.

Nochmals vielen Dank für Eure Beiträge, @TP-Sticker und @Christian.Saeum die mich letztlich auf die richtige Lösung gebracht haben,

Zur Info: Shopware ist -nicht- mit Twig 3.9 oder 3.10 kompatibel. Dafür wurde extra ein bugfix release veröffentlicht. Siehe dazu shopware/changelog/release-6-6-1-2/2024-04-23-block-twig-update.md at v6.6.1.2 · shopware/shopware · GitHub

Viele Grüße

Gut zu wissen, ich habe dementsprechend wieder ein Downgrade auf 3.8 vorgenommen:

bin/composer.phar require "twig/twig:^3.8.0"

Dieses Thema wurde automatisch 30 Tage nach der letzten Antwort geschlossen. Es sind keine neuen Antworten mehr erlaubt.