mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix max_execution_time with cli-server router script
When the cli-server specifies a router script, we run it using zend_execute_scripts instead of php_execute_script, because the former preserves the return value of the script. However, php_execute_script also starts resets the execution timer with the value from max_execution_time. If the timer has previously been initialized with max_input_time, it will never be reset, and thus trigger at the incorrect time. Closes GH-12886
This commit is contained in:
parent
de3c5c0bc8
commit
299c3ba89e
2 changed files with 15 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -2,6 +2,10 @@ PHP NEWS
|
|||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 8.2.15
|
||||
|
||||
- Cli:
|
||||
. Fix incorrect timeout in built-in web server when using router script and
|
||||
max_input_time. (ilutov)
|
||||
|
||||
21 Dec 2023, PHP 8.2.14
|
||||
|
||||
- Core:
|
||||
|
|
|
@ -2240,6 +2240,17 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
|
|||
zend_try {
|
||||
zval retval;
|
||||
|
||||
/* Normally php_execute_script restarts the timer with max_execution_time if it has
|
||||
* previously been initialized with max_input_time. We're not using php_execute_script here
|
||||
* because it does not provide a way to get the return value of the main script, so we need
|
||||
* to restart the timer manually. */
|
||||
if (PG(max_input_time) != -1) {
|
||||
#ifdef PHP_WIN32
|
||||
zend_unset_timeout();
|
||||
#endif
|
||||
zend_set_timeout(INI_INT("max_execution_time"), 0);
|
||||
}
|
||||
|
||||
ZVAL_UNDEF(&retval);
|
||||
if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE, &retval, 1, &zfd)) {
|
||||
if (Z_TYPE(retval) != IS_UNDEF) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue