mirror of https://github.com/flightphp/core
This partially revertspull/70/headcec890c
. In addition to other cleanup the commit changed from using $_SERVER to getenv. As @kafene said on issue #21, getenv provides a nicer API making the code clean. I.E. $val = getenv('val') ?: 'default'; Instead of: $val = isset($_SERVER['val']) ? $_SERVER['val'] : 'default'; Although this is true unfortuantly it is less reliable. Using getenv in this way assumes the application is running under some sort of CGI interface or an interface that is simulating the CGI interface. While this assumption is very often true it is not always true. For example when using [PHP built-in webserver][1] (useful for development) getenv will return false for most of these values even through $_SERVER is populated. I believe also some interfaces on Windows don't populate getenv. This means that flight is not usable in those environments. By partially revertingcec890c
we re-enable flight in those environments. For Engine.php and Response.php I just directly revertedcec890c
. Since request makes so much use of getenv it seemed wise to abstract the conditional checking to keep the code clean via a private function. The tests were also updated to populate $_SERVER instead of the environment via putenv. [1]: http://php.net/manual/en/features.commandline.webserver.php
parent
5414b906f6
commit
1a0eede079
Loading…
Reference in new issue