]> granicus.if.org Git - php/commitdiff
Fixed bug #52209 (INPUT_ENV returns NULL for set variables (CLI)).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 22 Dec 2010 16:18:59 +0000 (16:18 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 22 Dec 2010 16:18:59 +0000 (16:18 +0000)
NEWS
ext/filter/filter.c
ext/filter/tests/bug52209.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 849d9ddb80ab6cb1c2b7feec8457735751279aaa..f9188ecb81e13f1c998813d605a9b63122688e83 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@
 - Filter extension:
   . Fixed bug #53150 (FILTER_FLAG_NO_RES_RANGE is missing some IP ranges).
     (Ilia)
+  . Fixed bug #52209 (INPUT_ENV returns NULL for set variables (CLI)). (Ilia)
   . Fixed bug #47435 (FILTER_FLAG_NO_RES_RANGE don't work with ipv6).
     (Ilia, valli at icsurselva dot ch)
 
index d6f2090b3a4b58123ccffab4ed5513d0cc8ab1c8..a9753891a3fdc4cc16ae9794a9e23981a836369d 100644 (file)
@@ -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 (file)
index 0000000..49408ea
--- /dev/null
@@ -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"