#45264 [Opn->Bgs]: set_time_limit affects max_execution_time
| From: | derick@php.net | Date: | Sun, 15 Jun 2008 11:46:49 +0000 |
| Subject: | #45264 [Opn->Bgs]: set_time_limit affects max_execution_time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125788@lists.php.net to get a copy of this message | ||
ID: 45264
Updated by: derick@php.net
Reported By: jdm at visi dot com
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows
PHP Version: 5.2.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is correct, if you change it to something else, it should do that.
The reason for this is that for some installations the default is
unlimited, and you might want to protect parts of your app for running
over time.
Previous Comments:
------------------------------------------------------------------------
[2008-06-13 16:44:51] jdm at visi dot com
Description:
------------
Calling set_time_limit appears to not function as it is documented. Per
the documentation:
When called, set_time_limit() restarts the timeout counter from zero.
In other words, if the timeout is the default 30 seconds, and 25 seconds
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.
According to my test code, it is actually affecting the ini value of
max_execution_time. As a result if the time limit is a smaller value,
max_execution_time is altered to a smaller value, and script execution
time can be cut short.
I tracked this result down through drupal with the gallery2 integration
module included where it makes calls to set_time_limit(30), which causes
the module administration page to be cut short, even though my
max_execution_time is defined to be 300 seconds.
In my environment, the included code produces the following output:
300
30
Reproduce code:
---------------
print '<p>'.ini_get('max_execution_time').'</p>';
set_time_limit(30);
print '<p>'.ini_get('max_execution_time').'</p>';
Expected result:
----------------
I would expect the max_execution_time to either not change or be
extended by the amount set in set_time_limit, according to the
documented operation of it. i.e., the resulting code should produce
either:
300
300
or:
300
330
Actual result:
--------------
The resulting code produces this output:
300
30
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45264&edit=1