Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: remove server superglobal support#616

Merged
bshaffer merged 1 commit intomainfrom
remove-server-from-env
Apr 15, 2025
Merged

chore: remove server superglobal support#616
bshaffer merged 1 commit intomainfrom
remove-server-from-env

Conversation

@bshaffer
Copy link
Contributor

follow up to #612

Remove use of $_SERVER as it isn't really necessary to support it.

A bit picky of me, but I'd like to keep things as simple as possible.

cc @jannes-io

@bshaffer bshaffer requested a review from a team April 15, 2025 21:28
@bshaffer bshaffer merged commit 2e408f6 into main Apr 15, 2025
12 checks passed
@bshaffer bshaffer deleted the remove-server-from-env branch April 15, 2025 21:35
@jannes-io
Copy link
Contributor

Hi @bshaffer,

Totally agree things should be kept as simple and semantic as possible 👍

After some quick tests, $_SERVER is a valid location for env variables to exist when running from PHP cli for example.

Try the following script:

<?php

var_dump($_ENV);
var_dump($_SERVER);

php test.php results in

array(0) {
}
array(52) {
<my system's environment variables here>
}

So learning about this, keeping $_SERVER seems like the right thing to do.

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

Successfully merging this pull request may close these issues.

3 participants