summaryrefslogtreecommitdiff
path: root/ext/filter
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-12-22 16:18:59 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-12-22 16:18:59 +0000
commita68864969e459013e8e9c83b8604277cf9d59b89 (patch)
tree0654383f067d0ede4f961b640b696f9a1efc0b45 /ext/filter
parent880d61e9c6ae5d48689916b183d57ee7665b63fd (diff)
downloadphp-git-a68864969e459013e8e9c83b8604277cf9d59b89.tar.gz
Fixed bug #52209 (INPUT_ENV returns NULL for set variables (CLI)).
Diffstat (limited to 'ext/filter')
-rw-r--r--ext/filter/filter.c2
-rw-r--r--ext/filter/tests/bug52209.phpt10
2 files changed, 11 insertions, 1 deletions
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index d6f2090b3a..a9753891a3 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -559,7 +559,7 @@ static zval *php_filter_get_storage(long arg TSRMLS_DC)/* {{{ */
if (jit_initialization) {
zend_is_auto_global("_ENV", sizeof("_ENV")-1 TSRMLS_CC);
}
- array_ptr = IF_G(env_array);
+ array_ptr = IF_G(env_array) ? IF_G(env_array) : PG(http_globals)[TRACK_VARS_ENV];
break;
case PARSE_SESSION:
/* FIXME: Implement session source */
diff --git a/ext/filter/tests/bug52209.phpt b/ext/filter/tests/bug52209.phpt
new file mode 100644
index 0000000000..49408ea12d
--- /dev/null
+++ b/ext/filter/tests/bug52209.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #52209 (INPUT_ENV returns NULL for set variables (CLI))
+--SKIPIF--
+<?php if (!extension_loaded("filter") || !empty($_ENV['PWD'])) die("skip"); ?>
+--FILE--
+<?php
+ var_dump(filter_input(INPUT_ENV, 'PWD'));
+?>
+--EXPECTF--
+string(%d) "%s"