dmitry                                   Thu, 02 Feb 2012 12:58:54 +0000

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

Log:
Always restore PG(magic_quote_gpc) on request shutdown

Changed paths:
    U   php/php-src/branches/PHP_5_3/main/php_variables.c
    U   php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c

Modified: php/php-src/branches/PHP_5_3/main/php_variables.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/php_variables.c   2012-02-02 12:57:44 UTC 
(rev 323015)
+++ php/php-src/branches/PHP_5_3/main/php_variables.c   2012-02-02 12:58:54 UTC 
(rev 323016)
@@ -457,8 +457,11 @@

        /* turn off magic_quotes while importing environment variables */
        int magic_quotes_gpc = PG(magic_quotes_gpc);
-       PG(magic_quotes_gpc) = 0;

+       if (PG(magic_quotes_gpc)) {
+               zend_alter_ini_entry_ex("magic_quotes_gpc", 
sizeof("magic_quotes_gpc"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 
TSRMLS_CC);
+       }
+
        for (env = environ; env != NULL && *env != NULL; env++) {
                p = strchr(*env, '=');
                if (!p) {                               /* malformed entry? */
@@ -600,7 +603,9 @@
                zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
        }
        PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
-       PG(magic_quotes_gpc) = 0;
+       if (PG(magic_quotes_gpc)) {
+               zend_alter_ini_entry_ex("magic_quotes_gpc", 
sizeof("magic_quotes_gpc"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 
TSRMLS_CC);
+       }

        /* Server variables */
        if (sapi_module.register_server_variables) {

Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c    2012-02-02 12:57:44 UTC 
(rev 323015)
+++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c    2012-02-02 12:58:54 UTC 
(rev 323016)
@@ -624,7 +624,9 @@
                int filter_arg = (array_ptr == 
PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;

                /* turn off magic_quotes while importing environment variables 
*/
-               PG(magic_quotes_gpc) = 0;
+               if (PG(magic_quotes_gpc)) {
+                       zend_alter_ini_entry_ex("magic_quotes_gpc", 
sizeof("magic_quotes_gpc"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 
TSRMLS_CC);
+               }
                for (zend_hash_internal_pointer_reset_ex(request->env, &pos);
                        zend_hash_get_current_key_ex(request->env, &var, 
&var_len, &idx, 0, &pos) == HASH_KEY_IS_STRING &&
                        zend_hash_get_current_data_ex(request->env, (void **) 
&val, &pos) == SUCCESS;

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c        2012-02-02 
12:57:44 UTC (rev 323015)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c        2012-02-02 
12:58:54 UTC (rev 323016)
@@ -595,7 +595,9 @@
        filter_arg = (array_ptr == 
PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;

        /* turn off magic_quotes while importing environment variables */
-       PG(magic_quotes_gpc) = 0;
+       if (PG(magic_quotes_gpc)) {
+               zend_alter_ini_entry_ex("magic_quotes_gpc", 
sizeof("magic_quotes_gpc"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 
TSRMLS_CC);
+       }
        for (zend_hash_internal_pointer_reset_ex(request->env, &pos);
             zend_hash_get_current_key_ex(request->env, &var, &var_len, &idx, 
0, &pos) == HASH_KEY_IS_STRING &&
             zend_hash_get_current_data_ex(request->env, (void **) &val, &pos) 
== SUCCESS;

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

Reply via email to