Bug #49184 [Com]: INPUT_SERVER returns NULL for set variables (CLI)
| From: | mjk at emmjaykay dot org | Date: | Tue, 01 Feb 2011 22:19:13 +0000 |
| Subject: | Bug #49184 [Com]: INPUT_SERVER returns NULL for set variables (CLI) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158425@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=49184&edit=1
ID: 49184
Comment by: mjk at emmjaykay dot org
Reported by: m dot kurzyna at crystalpoint dot pl
Summary: INPUT_SERVER returns NULL for set variables (CLI)
Status: Verified
Type: Bug
Package: Filter related
Operating System: *
PHP Version: 5.*, 6 (2009-08-07)
Block user comment: N
Private report: N
New Comment:
Looking at the filter_input() call in filter.c:747 on 5.3.5, it looks
like the call to zend_hash_find() fails.
(gdb) call zend_hash_display(input->value->ht)
SCRIPT_FILENAME <==> 0x537C323A
SCRIPT_NAME <==> 0x9B9D269A
PATH_TRANSLATED <==> 0x3A4E2C63
PHP_SELF <==> 0xBD55DE96
DOCUMENT_ROOT <==> 0x1DB85847
DOCUMENT_ROOT <==> 0x1DB85847
PATH_TRANSLATED <==> 0x3A4E2C63
SCRIPT_FILENAME <==> 0x537C323A
SCRIPT_NAME <==> 0x9B9D269A
PHP_SELF <==> 0xBD55DE96
(gdb)
So I guess ENV_NAME never gets put in there at all?
Previous Comments:
------------------------------------------------------------------------
[2009-08-07 10:20:34] jani@php.net
This is quite strange, propably caused by bad design of the filter
extension.
------------------------------------------------------------------------
[2009-08-06 21:48:51] m dot kurzyna at crystalpoint dot pl
Description:
------------
This is very similar to #44779, however my report regards variables set
as environment variables when running CLI.
A variable is visible in $_SERVER but INPUT_SERVER returns NULL. Setting
via SetEnv in apache and when running as mod_php is fine.
Reproduce code:
---------------
<?php
var_dump(
filter_input(INPUT_SERVER,'ENV_NAME',FILTER_SANITIZE_STRING),
$_SERVER['ENV_NAME']
);
?>
Expected result:
----------------
$ ENV_NAME=var php /tmp/t.php
string(3) "var"
string(3) "var"
Actual result:
--------------
$ ENV_NAME=var php /tmp/t.php
NULL
string(3) "var"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=49184&edit=1