terminal42 / contao-pageimage

MIT License
12 stars 13 forks source link

Page image Error - mit neue Contao 4.11 #46

Closed Cleanerrr closed 3 years ago

Cleanerrr commented 3 years ago

[2021-02-23T12:51:49.316887+01:00] request.INFO: Matched route "tl_page.2.root". {"route":"tl_page.2.root","route_parameters":{"_token_check":true,"_controller":"Contao\\FrontendIndex::renderPage","_scope":"frontend","_locale":"de","_format":"html","parameters":"","pageModel":{"Contao\\PageModel":[]},"_route":"tl_page.2.root","_route_object":{"Symfony\\Component\\Routing\\Route":[]}},"request_uri":"http://mywebsite.com/","method":"GET"} [] [2021-02-23T12:51:49.344184+01:00] security.INFO: Populated the TokenStorage with an anonymous Token. [] [] [2021-02-23T12:51:49.409114+01:00] request.CRITICAL: Uncaught PHP Exception LogicException: ""contao.fragment._contao.frontend_module.pageimage" has no container set, did you forget to define it as a service subscriber?" at /www/htdocs/mywebsitepath/vendor/symfony/framework-bundle/Controller/ControllerResolver.php line 39 {"exception":"[object] (LogicException(code: 0): \"contao.fragment._contao.frontend_module.pageimage\" has no container set, did you forget to define it as a service subscriber? at /www/htdocs/mywebsitepath/vendor/symfony/framework-bundle/Controller/ControllerResolver.php:39)"} []

xprojects-de commented 3 years ago

Jip, habe den gleichen Fehler. Kam erst seit 4.11.1 und Symfony 5

[2021-03-16T07:21:15.937312+01:00] request.CRITICAL: Uncaught PHP Exception LogicException: ""contao.fragment._contao.frontend_module.pageimage" has no container set, did you forget to define it as a service subscriber?" at .../contao4/vendor/symfony/framework-bundle/Controller/ControllerResolver.php line 39 {"exception":"[object] (LogicException(code: 0): \"contao.fragment._contao.frontend_module.pageimage\" has no container set, did you forget to define it as a service subscriber? at .../contao4/vendor/symfony/framework-bundle/Controller/ControllerResolver.php:39)"} []

Cleanerrr commented 3 years ago

Hallo, ich habe gleiche Probleme mit andere Erweiterungen, wie mmenu, Rocksolid Slider,... Das Problem kann neue Contao 4.11. sein? Vieleicht...# Wenn ich letzte 4.10. version instaliert, habe ich kein Probleme mit Erweiterungen. Ich kann nicht neue Contao 4.11. verwenden wegen diese Problem. Haben Sie änliche Erfahrungen/Probleme ?

ab2211 commented 3 years ago

Ich habe den Fehler mit Contao 4.11 wenn ich die Erweiterung "Bild pro Seite" aktiviere.

aschempp commented 3 years ago

@terminal42/pilots @fritzmg any idea how we solved this in other extensions?

fritzmg commented 3 years ago

I haven't really looked into this problem yet.

dp-designpilot commented 3 years ago

Ich habe auch das gleiche Problem und würde die Erweiterung dringend benötigen (kannst Du das fixen Andy??)

xprojects-de commented 3 years ago

Hi,

Maybe, if NO autowire is set, the container must be given to the service via "call"? Isn't that a special case for the AbstractController? Actually thought that you don't have to do that anymore since the 4-version. But i can be wrong...!

calls: ['setContainer', ...Containerinterface]

EDIT: After reading the docs again, it shouldn't really be necessary... hmmm

fritzmg commented 3 years ago

@dp-designpilot as a workaround you could let symfony/framework-bundle be downgraded to 4.4.*, either by a require or conflict for "symfony/framework-bundle": ">=5".

dp-designpilot commented 3 years ago

@dp-designpilot as a workaround you could let symfony/framework-bundle be downgraded to 4.4.*, either by a require or conflict for "symfony/framework-bundle": ">=5".

Hallo Fritz Wie muss ich das genau machen, ich hab sowas noch nie gemacht ???

Weil ich hab einige Erweiterungen installiert:

und nun habe ich das Gefühl das wenn ich das mache es die Installation zerschiesst.

dp-designpilot commented 3 years ago

Hallo Fritz Ich habe das gemacht was Du gesagt hast jetzt ist es aber so, das ich wahrscheinlich Fehler in den beiden Erweiterungen habe (wahrscheinlich rührt das wegen dem folgenden Eintrag in der composer.json)

"symfony/framework-bundle": ">=5"

https://github.com/hofff/contao-tawk-to/issues/1 https://github.com/hofff/contao-facebook-pixel/issues/3

Und bei den beiden Erweiterungen ist die contao/manager-bundle locked

contao/manager-bundle is locked to version 4.11.2 and an update of this package was not requested

richardhj commented 3 years ago

We must set the container on the controller manually since Symfony 5.

I updated framework-bundle to Symfony 5 and NONE of my Page Controllers, Content Elements, Modules, or other Fragment Controllers were working.

First, I found the issue symfony/symfony#36495 that suggests that Controller services or their aliases must be public. I also updated the RegisterPagesPass / RegisterFragmentsPass to make those definitions public, but that's not working.

Other tickets (e.g. symfony/symfony#33755 and following) indicate that you must manually set the container to the service. This shouldn't be done via a compiler pass (see ticket).

After all, this remains the best fix:

services:
  _instanceof:
    Symfony\Bundle\FrameworkBundle\Controller\AbstractController:
      calls:
        - [ setContainer, [ '@Psr\Container\ContainerInterface' ] ]
aschempp commented 3 years ago

fixed in 68d0576fd7269dcea7ec51f0a90ece72060aed3d

also see https://github.com/contao/contao/pull/3098 (@richardhj)