From: jdm at visi dot com
Operating system: Windows
PHP version: 5.2.6
PHP Bug Type: Performance problem
Bug description: set_time_limit affects max_execution_time
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 bug report at http://bugs.php.net/?id=45264&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45264&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45264&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45264&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45264&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45264&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45264&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45264&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45264&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45264&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45264&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45264&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45264&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45264&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45264&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45264&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45264&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45264&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45264&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45264&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45264&r=mysqlcfg