Closed Art4 closed 8 years ago
https://bugs.php.net/bug.php?id=67808
Which suggests the SAPI behaviour (of copying the data to $_SERVER) is percieved as wrong. How about:
Fuel::$env = Arr::get($_SERVER, 'FUEL_ENV', Arr::get($_ENV, 'FUEL_ENV', Fuel::DEVELOPMENT));
We could probably even switch to simply using $_ENV, that should always work.
Using $_ENV instead of $_SERVER seems to work fine.
I've committed the change to the Fuel repo.
Great, thank you very much!
I'll use the changes from https://github.com/fuel/fuel/commit/7b0a92425a01320135f3fdb5e7d1cbe9ff318c30
Nope, it is more complex.
So both need to be checked.
Symfony simply merged $_ENV
into $_SERVER
for the same issue, see https://github.com/symfony/symfony/commit/61763452b7d265e883f5edaf76b50d15074a8e81
I find that a bit of a hack, as it obscures what happens. And not very secure as well, as it allows a SERVER variable to be overwritten by an ENV variable, of which the source might not be known.
I want to use the PHP built-in server for test purpose but have trouble with setting the right environment.
I'm starting the server like this:
env FUEL_ENV=test php -d variables_order=EGPCS -S localhost:8000 -t public/
But the problem is that in the built-in server the
FUEL_ENV
appears only in$_ENV
but not in$_SERVER
. I'd workaround this with adding this line infuel/app/bootstrap.php
:This works, but seems ugly to me. Am I missing something and there is a better way to achieve this problem?