From: Wez Furlong Date: Tue, 19 Jul 2005 18:59:46 +0000 (+0000) Subject: Don't crash when no treat_data method has been set in the sapi module X-Git-Tag: RELEASE_0_9~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=546418a66b4df839325419eb70616357c0b55ffe;p=php Don't crash when no treat_data method has been set in the sapi module # how come no one ran into this before? --- diff --git a/main/php_variables.c b/main/php_variables.c index b468c51df0..c6bdbbff47 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -625,7 +625,9 @@ int php_hash_environment(TSRMLS_D) case 'p': case 'P': if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) { - sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */ + if (sapi_module.treat_data) { + sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */ + } _gpc_flags[0] = 1; if (PG(register_globals)) { php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC); @@ -635,7 +637,9 @@ int php_hash_environment(TSRMLS_D) case 'c': case 'C': if (!_gpc_flags[1]) { - sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); /* Cookie Data */ + if (sapi_module.treat_data) { + sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); /* Cookie Data */ + } _gpc_flags[1] = 1; if (PG(register_globals)) { php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC); @@ -645,7 +649,9 @@ int php_hash_environment(TSRMLS_D) case 'g': case 'G': if (!_gpc_flags[2]) { - sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC); /* GET Data */ + if (sapi_module.treat_data) { + sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC); /* GET Data */ + } _gpc_flags[2] = 1; if (PG(register_globals)) { php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC);