Bug #75712 [NEW]: If $_SERVER['argv'] exists in code, calls to getenv() will return argv and argc
| From: | adam at lavoaster dot co dot uk | Date: | Wed, 20 Dec 2017 13:18:07 +0000 |
| Subject: | Bug #75712 [NEW]: If $_SERVER['argv'] exists in code, calls to getenv() will return argv and argc | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213176@lists.php.net to get a copy of this message | ||
From: adam at lavoaster dot co dot uk
Operating system: linux
PHP version: 7.1.12
Package: *General Issues
Bug Type: Bug
Bug description:If $_SERVER['argv'] exists in code, calls to getenv() will return argv and
argc
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 bug report at https://bugs.php.net/bug.php?id=75712&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75712&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75712&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75712&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75712&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75712&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75712&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75712&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75712&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75712&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75712&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75712&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75712&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75712&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75712&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75712&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75712&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75712&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75712&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75712&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75712&r=mysqlcfg