From: Gustavo André dos Santos Lopes Date: Thu, 9 Dec 2010 20:35:59 +0000 (+0000) Subject: - Added enable_post_data_reading ini option to allow inhibiting POST data consumption. X-Git-Tag: php-5.4.0alpha1~191^2~544 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6654a4ade5da2c23ba39d6e89bd738f9819c5954;p=php - Added enable_post_data_reading ini option to allow inhibiting POST data consumption. --- diff --git a/main/SAPI.c b/main/SAPI.c index 7fa8775a93..2094219154 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -393,7 +393,7 @@ SAPI_API void sapi_activate(TSRMLS_D) /* handle request mehtod */ if (SG(server_context)) { - if ( SG(request_info).request_method) { + if (PG(enable_post_data_reading) && SG(request_info).request_method) { if(!strcmp(SG(request_info).request_method, "POST") && (SG(request_info).content_type)) { /* HTTP POST -> may contain form data to be read into variables diff --git a/main/main.c b/main/main.c index f58853f419..822f34e80d 100644 --- a/main/main.c +++ b/main/main.c @@ -490,6 +490,7 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("allow_url_include", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_url_include, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("enable_post_data_reading", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, enable_post_data_reading, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals) diff --git a/main/php_globals.h b/main/php_globals.h index 921168e8c4..2ef234ae38 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -132,6 +132,7 @@ struct _php_core_globals { zend_bool file_uploads; zend_bool during_request_startup; zend_bool allow_url_fopen; + zend_bool enable_post_data_reading; zend_bool always_populate_raw_post_data; zend_bool report_zend_debug; diff --git a/tests/basic/enable_post_data_reading_01.phpt b/tests/basic/enable_post_data_reading_01.phpt new file mode 100644 index 0000000000..1a0e33f617 --- /dev/null +++ b/tests/basic/enable_post_data_reading_01.phpt @@ -0,0 +1,22 @@ +--TEST-- +enable_post_data_reading: basic test +--INI-- +enable_post_data_reading=0 +--POST_RAW-- +Content-Type: application/x-www-form-urlencoded +a=1&b=ZYX +--FILE-- +