getenv("ANYSTRING") is causing an internal server error

646 views Asked by At

For some reason getenv("ANYSTRING") is causing an internal server error. getenv() without any arguments returns an array of environment variables as expected. I am running PHP 7.1.13 x86 Thread Safe using mod_fcgid on Apache Lounge VC15 2.4.27 (Win32) in Windows 10 x64.

I cannot simply use getenv() as this code is part of the composer framework and therefore I would rather not modify it (in EventDispatcher.php).

It appears that this is related to Bug #75794 and #75761, as adding the second parameter (local_only) to true resolves the crash, whereas setting this parameter to false or omitting it entirely causes the crash to reoccur.

Anyone have any thoughts on how to get around this issue?

1

There are 1 answers

1
Evriwon On

It appears that this is related to Bug #75794 and #75761, as adding the second parameter (local_only) to true resolves the crash, whereas setting this parameter to false or omitting it entirely causes the crash to reoccur.

To fix the issue, use the patch here and rebuild your version of php, or use a different version of PHP altogether (7.0.x or 7.2.x).