iliaa                                    Wed, 22 Dec 2010 16:18:59 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306575

Log:
Fixed bug #52209 (INPUT_ENV returns NULL for set variables (CLI)).

Bug: http://bugs.php.net/52209 (Open) INPUT_ENV returns NULL for set variables 
(CLI)
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/filter/filter.c
    A   php/php-src/branches/PHP_5_3/ext/filter/tests/bug52209.phpt
    U   php/php-src/trunk/ext/filter/filter.c
    A   php/php-src/trunk/ext/filter/tests/bug52209.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-12-22 16:03:43 UTC (rev 306574)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-12-22 16:18:59 UTC (rev 306575)
@@ -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)


Modified: php/php-src/branches/PHP_5_3/ext/filter/filter.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/filter.c    2010-12-22 16:03:43 UTC 
(rev 306574)
+++ php/php-src/branches/PHP_5_3/ext/filter/filter.c    2010-12-22 16:18:59 UTC 
(rev 306575)
@@ -559,7 +559,7 @@
                        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 */

Added: php/php-src/branches/PHP_5_3/ext/filter/tests/bug52209.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/tests/bug52209.phpt                 
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/filter/tests/bug52209.phpt 2010-12-22 
16:18:59 UTC (rev 306575)
@@ -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"

Modified: php/php-src/trunk/ext/filter/filter.c
===================================================================
--- php/php-src/trunk/ext/filter/filter.c       2010-12-22 16:03:43 UTC (rev 
306574)
+++ php/php-src/trunk/ext/filter/filter.c       2010-12-22 16:18:59 UTC (rev 
306575)
@@ -546,7 +546,7 @@
                        if (PG(auto_globals_jit)) {
                                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 */

Added: php/php-src/trunk/ext/filter/tests/bug52209.phpt
===================================================================
--- php/php-src/trunk/ext/filter/tests/bug52209.phpt                            
(rev 0)
+++ php/php-src/trunk/ext/filter/tests/bug52209.phpt    2010-12-22 16:18:59 UTC 
(rev 306575)
@@ -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"

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to