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

Undefined array key "QUERY_STRING" #22

Open
tomkyle opened this issue Feb 17, 2021 · 0 comments
Open

Undefined array key "QUERY_STRING" #22

tomkyle opened this issue Feb 17, 2021 · 0 comments

Comments

@tomkyle
Copy link

tomkyle commented Feb 17, 2021

On certain circumstances, in init() method a PHP warning is thrown:

Warning: Undefined array key "QUERY_STRING" in path/to/vendor/mmamedov/page-cache/src/PageCache.php on line 133

It seems $_SERVER['QUERY_STRING'] may not be set sometimes (for me: PHP 8 on localhost/internal webserver). This causes PHP to generate a warning, when the init() method calls the log method – passing URI, script name and query string.

According to the Manual [1], one indeed ”may or may not find any of the elements in $_SERVER”. So my proposal is to introduce a check if $_SERVER fields are set. If a PR is welcome, I'll happily send one around.

[1] https://www.php.net/manual/en/reserved.variables.server.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant