cataphract Thu, 09 Dec 2010 20:35:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=306143
Log: - Added enable_post_data_reading ini option to allow inhibiting POST data consumption. Changed paths: U php/php-src/trunk/main/SAPI.c U php/php-src/trunk/main/main.c U php/php-src/trunk/main/php_globals.h A php/php-src/trunk/tests/basic/enable_post_data_reading_01.phpt A php/php-src/trunk/tests/basic/enable_post_data_reading_02.phpt A php/php-src/trunk/tests/basic/enable_post_data_reading_03.phpt A php/php-src/trunk/tests/basic/enable_post_data_reading_04.phpt Modified: php/php-src/trunk/main/SAPI.c =================================================================== --- php/php-src/trunk/main/SAPI.c 2010-12-09 20:31:38 UTC (rev 306142) +++ php/php-src/trunk/main/SAPI.c 2010-12-09 20:35:59 UTC (rev 306143) @@ -393,7 +393,7 @@ /* 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 Modified: php/php-src/trunk/main/main.c =================================================================== --- php/php-src/trunk/main/main.c 2010-12-09 20:31:38 UTC (rev 306142) +++ php/php-src/trunk/main/main.c 2010-12-09 20:35:59 UTC (rev 306143) @@ -490,6 +490,7 @@ 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) Modified: php/php-src/trunk/main/php_globals.h =================================================================== --- php/php-src/trunk/main/php_globals.h 2010-12-09 20:31:38 UTC (rev 306142) +++ php/php-src/trunk/main/php_globals.h 2010-12-09 20:35:59 UTC (rev 306143) @@ -132,6 +132,7 @@ 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; Added: php/php-src/trunk/tests/basic/enable_post_data_reading_01.phpt =================================================================== --- php/php-src/trunk/tests/basic/enable_post_data_reading_01.phpt (rev 0) +++ php/php-src/trunk/tests/basic/enable_post_data_reading_01.phpt 2010-12-09 20:35:59 UTC (rev 306143) @@ -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-- +<?php +var_dump($_FILES); +var_dump($_POST); +var_dump($HTTP_RAW_POST_DATA); +var_dump(file_get_contents("php://input")); +--EXPECTF-- +array(0) { +} +array(0) { +} + +Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d +NULL +string(9) "a=1&b=ZYX" Property changes on: php/php-src/trunk/tests/basic/enable_post_data_reading_01.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Added: svn:eol-style + native Added: php/php-src/trunk/tests/basic/enable_post_data_reading_02.phpt =================================================================== --- php/php-src/trunk/tests/basic/enable_post_data_reading_02.phpt (rev 0) +++ php/php-src/trunk/tests/basic/enable_post_data_reading_02.phpt 2010-12-09 20:35:59 UTC (rev 306143) @@ -0,0 +1,28 @@ +--TEST-- +enable_post_data_reading: rfc1867 +--INI-- +enable_post_data_reading=0 +--POST_RAW-- +Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 +-----------------------------20896060251896012921717172737 +Content-Disposition: form-data; name="file1"; filename="file1.txt" +Content-Type: text/plain-file + +1 +-----------------------------20896060251896012921717172737-- +--FILE-- +<?php +var_dump($_FILES); +var_dump($_POST); +var_dump(file_get_contents("php://input")); +--EXPECTF-- +array(0) { +} +array(0) { +} +string(224) "-----------------------------20896060251896012921717172737 +Content-Disposition: form-data; name="file1"; filename="file1.txt" +Content-Type: text/plain-file + +1 +-----------------------------20896060251896012921717172737--" Property changes on: php/php-src/trunk/tests/basic/enable_post_data_reading_02.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Added: svn:eol-style + native Added: php/php-src/trunk/tests/basic/enable_post_data_reading_03.phpt =================================================================== --- php/php-src/trunk/tests/basic/enable_post_data_reading_03.phpt (rev 0) +++ php/php-src/trunk/tests/basic/enable_post_data_reading_03.phpt 2010-12-09 20:35:59 UTC (rev 306143) @@ -0,0 +1,23 @@ +--TEST-- +enable_post_data_reading: always_populate_raw_post_data has no effect (1) +--INI-- +enable_post_data_reading=0 +always_populate_raw_post_data=1 +--POST_RAW-- +Content-Type: application/x-www-form-urlencoded +a=1&b=ZYX +--FILE-- +<?php +var_dump($_FILES); +var_dump($_POST); +var_dump($HTTP_RAW_POST_DATA); +var_dump(file_get_contents("php://input")); +--EXPECTF-- +array(0) { +} +array(0) { +} + +Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d +NULL +string(9) "a=1&b=ZYX" Property changes on: php/php-src/trunk/tests/basic/enable_post_data_reading_03.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Added: svn:eol-style + native Added: php/php-src/trunk/tests/basic/enable_post_data_reading_04.phpt =================================================================== --- php/php-src/trunk/tests/basic/enable_post_data_reading_04.phpt (rev 0) +++ php/php-src/trunk/tests/basic/enable_post_data_reading_04.phpt 2010-12-09 20:35:59 UTC (rev 306143) @@ -0,0 +1,23 @@ +--TEST-- +enable_post_data_reading: always_populate_raw_post_data has no effect (2) +--INI-- +enable_post_data_reading=0 +always_populate_raw_post_data=1 +--POST_RAW-- +Content-Type: application/unknown +a=1&b=ZYX +--FILE-- +<?php +var_dump($_FILES); +var_dump($_POST); +var_dump($HTTP_RAW_POST_DATA); +var_dump(file_get_contents("php://input")); +--EXPECTF-- +array(0) { +} +array(0) { +} + +Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d +NULL +string(9) "a=1&b=ZYX" Property changes on: php/php-src/trunk/tests/basic/enable_post_data_reading_04.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Added: svn:eol-style + native
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php