summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-11 22:55:54 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-11 22:55:54 -0400
commitdc264c53d9d63103b35e6a2edfb6b0128d2e2480 (patch)
tree07ccdcddad6a6e5200b7cdc2395746b6030be723 /includes
parent692440692862d42f6ec4b2c4fec6e06c9b72e169 (diff)
downloadbrdo-dc264c53d9d63103b35e6a2edfb6b0128d2e2480.tar.gz
brdo-dc264c53d9d63103b35e6a2edfb6b0128d2e2480.tar.bz2
Issue #2233929 by alexpott, Dave Reid, Berdir, YesCT: drupal_set_time_limit should not be able to change the time limit if it's already unlimited
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/includes/common.inc b/includes/common.inc
index acef70afb..e863f411f 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2812,11 +2812,11 @@ function drupal_map_assoc($array, $function = NULL) {
* into script execution a call such as set_time_limit(20) is made, the
* script will run for a total of 45 seconds before timing out.
*
- * It also means that it is possible to decrease the total time limit if
- * the sum of the new time limit and the current time spent running the
- * script is inferior to the original time limit. It is inherent to the way
- * set_time_limit() works, it should rather be called with an appropriate
- * value every time you need to allocate a certain amount of time
+ * If the current time limit is not unlimited it is possible to decrease the
+ * total time limit if the sum of the new time limit and the current time spent
+ * running the script is inferior to the original time limit. It is inherent to
+ * the way set_time_limit() works, it should rather be called with an
+ * appropriate value every time you need to allocate a certain amount of time
* to execute a task than only once at the beginning of the script.
*
* Before calling set_time_limit(), we check if this function is available
@@ -2833,7 +2833,11 @@ function drupal_map_assoc($array, $function = NULL) {
*/
function drupal_set_time_limit($time_limit) {
if (function_exists('set_time_limit')) {
- @set_time_limit($time_limit);
+ $current = ini_get('max_execution_time');
+ // Do not set time limit if it is currently unlimited.
+ if ($current != 0) {
+ @set_time_limit($time_limit);
+ }
}
}