Skip to content

[Platform] Use $_SERVER instead of $_ENV #92

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

Merged
merged 1 commit into from
Jul 12, 2025
Merged

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Jul 11, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues
License MIT

on many PHP distribution (for example on ubuntu), variables_order ini setting does not include E flag:

php -i | grep variables_order
variables_order => GPCS => GPCS

So this script:

echo 'env(VAR): ' . ($_ENV['VAR'] ?? 'not set');
echo "\n";
echo 'server(VAR): ' . ($_SERVER['VAR'] ?? 'not set');
echo "\n";

outputs:

$ VAR=hello php test.php
env(VAR): not set
server(VAR): hello

on many PHP distribution (for example on ubuntu), [`variables_order` ini
setting](https://www.php.net/manual/en/ini.core.php#ini.variables-order)
does not include `E` flag:

```
php -i | grep variables_order
variables_order => GPCS => GPCS
```

So this script:
```
echo 'env(VAR): ' . ($_ENV['VAR'] ?? 'not set');
echo "\n";
echo 'server(VAR): ' . ($_SERVER['VAR'] ?? 'not set');
echo "\n";
```

outputs:

```console
$ VAR=hello php test.php
env(VAR): not set
server(VAR): hello
```
@lyrixx lyrixx requested review from chr-hertel and Nyholm as code owners July 11, 2025 13:35
@welcoMattic
Copy link
Member

@lyrixx
Copy link
Member Author

lyrixx commented Jul 11, 2025

@welcoMattic This is already included in the PR: https://github.com/symfony/ai/pull/92/files#diff-c391100c684337820ecf54ead222f452862ec0e410853627752c289e9e259c1b

@welcoMattic
Copy link
Member

My bad, missed it 🙈

Copy link
Contributor

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, wasn't aware - thank you @lyrixx!

@OskarStark OskarStark added the Platform Issues & PRs about the AI Platform component label Jul 11, 2025
@OskarStark OskarStark changed the title Use $_SERVER instead of $_ENV [Platform] Use $_SERVER instead of $_ENV Jul 11, 2025
@chr-hertel
Copy link
Contributor

Thank you @lyrixx.

@chr-hertel chr-hertel merged commit 97e4d50 into symfony:main Jul 12, 2025
13 checks passed
@lyrixx lyrixx deleted the SERVER branch July 12, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Issues & PRs about the AI Platform component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants