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

MemoryTokenStorage must not be accessed before it was initialized. #582

Closed
thecompix opened this issue Jul 15, 2019 · 8 comments
Closed

Comments

@thecompix
Copy link

Hey Guys,
i use Contao Version 4.7.6 and i get this error msg:

[2019-07-15 10:01:58] request.CRITICAL: Uncaught PHP Exception LogicException: "MemoryTokenStorage must not be accessed before it was initialized." at /is/htdocs/wp1009504_JLFFFN68HQ/contao-2019/vendor/contao/core-bundle/src/Csrf/MemoryTokenStorage.php line 109 {"exception":"[object] (LogicException(code: 0): MemoryTokenStorage must not be accessed before it was initialized. at /is/htdocs/wp1009504_JLFFFN68HQ/contao-2019/vendor/contao/core-bundle/src/Csrf/MemoryTokenStorage.php:109)"} []

My Hoster Provider is HostEurope.
What is the Solution to fix this error?

@leofeyer
Copy link
Member

Please refer to the forums or our Slack channel for this kind of questions. If it turns out to be a bug in Contao, please report back here.

@Metis77
Copy link

Metis77 commented Nov 29, 2019

I can reproduce this now:

  • PHP 7.3.5 FMP

  • Server accepts urls with and without www.

  • Contao Page Caching is set to:
    -- Cachezeit Private-Cache = 0
    -- Cachezeit Shared-Cache = 7 Tage
    -- Immer aus dem Shared-Cache laden = true

  • cache is created for version without www

  • if the www version is loaded, assest cant be loaded

  • the contao log file gets the above error entry.

@fritzmg
Copy link
Contributor

fritzmg commented Nov 29, 2019

@Metis77 you must redirect to the correct domain.

@Metis77
Copy link

Metis77 commented Nov 29, 2019

@fritzmg yes sure, I am doing so now.

Still this triggers the above error.
Not sure what should be done, but if this is not intended to work, contao should also not deliver the cache from a different domain at all.

@Anke
Copy link

Anke commented Dec 4, 2019

I just got this error message after just entering "oberhof24.de" instead of "http(s)://oberhof24.de" in the browser (Contao 4.8.4) and I noticed that this error has been logged several times since 25th November (possibly after updating from Contao 4.7.x):

[2019-12-04 11:31:21] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: "" at /.../vendor/symfony/http-kernel/EventListener/FragmentListener.php line 92 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException(code: 0):  at /.../vendor/symfony/http-kernel/EventListener/FragmentListener.php:92)"}
[2019-12-04 11:31:21] request.CRITICAL: Uncaught PHP Exception LogicException: "MemoryTokenStorage must not be accessed before it was initialized." at /.../vendor/contao/core-bundle/src/Csrf/MemoryTokenStorage.php line 109 {"exception":"[object] (LogicException(code: 0): MemoryTokenStorage must not be accessed before it was initialized. at /.../vendor/contao/core-bundle/src/Csrf/MemoryTokenStorage.php:109)"}

Edit: Das passiert nicht bei jedem Aufruf ohne http oder https. Als ich es eben noch einmal versucht habe, wurde "oberhof24.de" korrekt umgeleitet auf "https://oberhof24.de".

@mlwebworker
Copy link

Ich habe heute diesen Fehler auch.
Contao 4.8.7
Provider DF
PHP 7.3

Der Fehler tritt nur auf wenn ich nicht im Backend eingeloggt bin

@fritzmg
Copy link
Contributor

fritzmg commented Dec 23, 2019

@mlwebworker lässt du http auf https redirecten und example.org auf www.example.org (oder umgekehrt, je nach dem)?

@mlwebworker
Copy link

Nein für die Version, die gerade in der Entwicklung ist kann mir der Kunde kein Zertifikat zur Verfügung stellen. DF stellt ja keine Lets Encrypt Zertifikate zur Verfügung und Umleitung auf www habe ich in der Version für die Entwicklung auch noch auskommentiert.
Habe mir aber auf Grund Deines Hinweises mal die .htaccess genauer angeschaut. Dort habe ich nämlich gestern Weiterleitungen aus der Live-Installation übernommen. Die haben Weiterleitungen auf die entsprechenden https Seite. Vielleicht war das die Ursache. Habe diese Weiterleitungen erst mal auskommentiert und der Fehler tritt nicht mehr auf. Leider aber auch beim zurücksetzen auf die alte Version nicht. Ich werde das mal weiter beobachten. Falls der Fehler wieder auftritt melde ich mich.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants