Req #76008 [NEW]: Add parameters to getallheaders or apache_request_headers
| From: | valentiny510 at gmail dot com | Date: | Sun, 25 Feb 2018 23:49:30 +0000 |
| Subject: | Req #76008 [NEW]: Add parameters to getallheaders or apache_request_headers | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-214103@lists.php.net to get a copy of this message | ||
From: valentiny510 at gmail dot com
Operating system:
PHP version: 7.2.2
Package: Apache related
Bug Type: Feature/Change Request
Bug description:Add parameters to getallheaders or apache_request_headers
Description:
------------
array getallheaders ( void )
array apache_request_headers ( void )
... We already have many ways to get some header if need,
apache_request_headers, getallheaders are the same...
$_SERVER, $_REQUEST, $_ENV, $GLOBALS (if not unset), etc..
Is full of arrays all over the place and there is no way to get some
variable without using "isset" (aside: I think isset is the most used
word in PHP)
I know we can use $_SERVER['whatever'] ?? null
but for once whould be nice to have a function that return null for us
by default in case it not exists..
My request is to add a new parameter to any of that function
getallheaders/apache_request_headers($header_name = null),
or create a new function, i.e. getheader(string $name = null/void)
will be much faster if is implemented in the core, and easier to work
with..
if ('php.net' = getheader('host'))
do something...
instead of
$headers = getallheaders( );
if (isset($headers['Host']) && $headers['Host'] == 'php.net')
do something...
you got the idea... Thank you
--
Edit bug report at https://bugs.php.net/bug.php?id=76008&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76008&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76008&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76008&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76008&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76008&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76008&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76008&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76008&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76008&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76008&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76008&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76008&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76008&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76008&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76008&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76008&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76008&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76008&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76008&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76008&r=mysqlcfg