From 87c038be06b8b0eb721270f98c858fd701f5d54b Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 2 Feb 2012 12:58:54 +0000 Subject: Always restore PG(magic_quote_gpc) on request shutdown --- main/php_variables.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'main/php_variables.c') diff --git a/main/php_variables.c b/main/php_variables.c index e50f5f7f7c..32588d5f8f 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -457,7 +457,10 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) /* 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, '='); @@ -600,7 +603,9 @@ static inline void php_register_server_variables(TSRMLS_D) 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) { -- cgit v1.2.1