summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2002-10-21 13:09:29 +0000
committerIlia Alshanetsky <iliaa@php.net>2002-10-21 13:09:29 +0000
commitb9efd223395eb66bf7503a3f8a86d8eb67d4ae13 (patch)
treecc618e34d2faccd588850fd953db222b91b4bc18
parentdde85e3936f2d67cfb405ed77c08c429e4954186 (diff)
downloadphp-git-b9efd223395eb66bf7503a3f8a86d8eb67d4ae13.tar.gz
Fixed bug #16880. Added an ini option max_input_time that allows the user
to specify how much time a script may spend parsing input data (POST, GET, etc..).
-rw-r--r--main/main.c5
-rw-r--r--main/php_globals.h1
-rw-r--r--php.ini-dist1
-rw-r--r--php.ini-recommended1
4 files changed, 7 insertions, 1 deletions
diff --git a/main/main.c b/main/main.c
index 6176574d3b..e112e63c14 100644
--- a/main/main.c
+++ b/main/main.c
@@ -251,6 +251,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("html_errors", "1", PHP_INI_ALL, OnUpdateBool, html_errors, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("xmlrpc_errors", "0", PHP_INI_SYSTEM, OnUpdateBool, xmlrpc_errors, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("xmlrpc_error_number", "0", PHP_INI_ALL, OnUpdateInt, xmlrpc_error_number, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("max_input_time", "0", PHP_INI_ALL, OnUpdateInt, max_input_time, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("ignore_user_abort", "0", PHP_INI_ALL, OnUpdateBool, ignore_user_abort, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("implicit_flush", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, implicit_flush, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals)
@@ -835,7 +836,7 @@ int php_request_startup(TSRMLS_D)
zend_activate(TSRMLS_C);
sapi_activate(TSRMLS_C);
- zend_set_timeout(EG(timeout_seconds));
+ zend_set_timeout(PG(max_input_time));
if (PG(expose_php)) {
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
@@ -1539,6 +1540,8 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
php_mbstring_set_zend_encoding(TSRMLS_C);
#endif /* ZEND_MULTIBYTE && HAVE_MBSTRING */
+ zend_unset_timeout(TSRMLS_C);
+ zend_set_timeout(EG(timeout_seconds));
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS);
if (old_primary_file_path) {
diff --git a/main/php_globals.h b/main/php_globals.h
index 579201f75d..b24b1df8a7 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -71,6 +71,7 @@ struct _php_core_globals {
char *safe_mode_exec_dir;
long memory_limit;
+ long max_input_time;
zend_bool track_errors;
zend_bool display_errors;
diff --git a/php.ini-dist b/php.ini-dist
index 34d3b86032..61910638e6 100644
--- a/php.ini-dist
+++ b/php.ini-dist
@@ -218,6 +218,7 @@ expose_php = On
;;;;;;;;;;;;;;;;;;;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
+max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/php.ini-recommended b/php.ini-recommended
index 9b378fb96d..20957460eb 100644
--- a/php.ini-recommended
+++ b/php.ini-recommended
@@ -232,6 +232,7 @@ expose_php = On
;;;;;;;;;;;;;;;;;;;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
+max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)