Bug #75712 [Opn->Fbk]: If $_SERVER['argv'] exists in code, calls to getenv() will return argv and argc

From: Date: Wed, 20 Dec 2017 13:34:15 +0000
Subject: Bug #75712 [Opn->Fbk]: If $_SERVER['argv'] exists in code, calls to getenv() will return argv and argc
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213177@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75712&edit=1 ID: 75712 Updated by: requinix@php.net Reported by: adam at lavoaster dot co dot uk Summary: If $_SERVER['argv'] exists in code, calls to getenv() will return argv and argc -Status: Open +Status: Feedback Type: Bug Package: *General Issues Operating System: linux PHP Version: 7.1.12 Block user comment: N Private report: N New Comment: I haven't been able to reproduce with the CLI or the embedded server. Which SAPIs? (Apache module, FastCGI, etc.) Does it happen if you reference $_SERVER at all and not just with ['argv'], as in function notcalled() { $_SERVER; } Previous Comments: ------------------------------------------------------------------------ [2017-12-20 13:18:06] adam at lavoaster dot co dot uk Description: ------------ This came out of looking into an issue here - https://github.com/symfony/symfony/issues/25511 If $_SERVER['argv'] exists anywhere in the code, it doesn't matter if it isn't called, just as long it's included, it will add 'argv' and 'argc' to the return of 'getenv()' when called without any parameters. Just a note: If you have xdebug installed, this issue will not present itself. Test script: --------------- <?php var_dump(getenv()); function notcalled() { $_SERVER['argv']; } Expected result: ---------------- It shouldn't return 'argv' or 'argc' in the return array, especially as 'argv' is an array which would break scripts that would directly use getenv(), like Symfony process did, straight into proc_open. Actual result: -------------- It returns 'argv' and 'argc' in the returning array. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75712&edit=1

« previous php.bugs (#213177) next »