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

Using $_COOKIE is forbidden, use rex_request::cookie() or rex_cookie() instead. #308

Open
staabm opened this issue Jan 19, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@staabm
Copy link
Member

staabm commented Jan 19, 2023

Description / Beschreibung

this error should not happen for code like $x = $_COOKIE; - so when not a dedicated key is retrieved

@staabm staabm added the bug Something isn't working label Jan 19, 2023
@aeberhard
Copy link
Member

Same bei anderen globalen Variablen $_GET, $_POST, $_FILES !?

@staabm
Copy link
Member Author

staabm commented Jan 19, 2023

könnte sein. allerdings ist es fragwürdig, warum/wann man wirklich alle diese variablen brauch.

klingt nach einem problem im design

@aeberhard
Copy link
Member

Könnte ja sein dass man dynamische Namen verwendet z.b. ??
War ja auch nur ein Hinweis.

@staabm
Copy link
Member Author

staabm commented Jan 19, 2023

haste nen konkreteres beispiel?

@aeberhard
Copy link
Member

Ich habe da jetzt kein konkretes Beispiel. Könnte mir aber vorstellen wenn mit Javascript etliches Zeugs zusammengeklickert wird wäre es manchmal von Vorteil alle Werte gleich in ein Array zu bekommen.

Aber es passt auch wenn man die Zeile mit @phpstan-ignore-line kommentiert.

$_COOKIE wird übrigens im consent_manager-AddOn verwendet.

@staabm
Copy link
Member Author

staabm commented Jan 24, 2023

@gharlan ich frage mich ob wir ggf. bei übergeben von NULL o.ä. rex_request::cookie() das volle array zurückgeben lassen sollte?

oder ggf. ein separater api call? aber ggf. brauch man das auch für GET/POST etc.

@gharlan
Copy link
Member

gharlan commented Jan 24, 2023

Man kommt an das Array auch über das Symfony-Request-Objekt: rex::getRequest()->cookies->all()

Denke es ist schon eher selten, dass man direkt an das Array muss. Ich glaube, ich würde dafür nicht extra eine Methode bei uns einführen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants