Skip to content

Commit 5f3b4c5

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix max_execution_time with cli-server router script
2 parents b2483a1 + a559a5e commit 5f3b4c5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sapi/cli/php_cli_server.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,6 +2249,17 @@ static bool php_cli_server_dispatch_router(php_cli_server *server, php_cli_serve
22492249
zend_try {
22502250
zval retval;
22512251

2252+
/* Normally php_execute_script restarts the timer with max_execution_time if it has
2253+
* previously been initialized with max_input_time. We're not using php_execute_script here
2254+
* because it does not provide a way to get the return value of the main script, so we need
2255+
* to restart the timer manually. */
2256+
if (PG(max_input_time) != -1) {
2257+
#ifdef PHP_WIN32
2258+
zend_unset_timeout();
2259+
#endif
2260+
zend_set_timeout(INI_INT("max_execution_time"), 0);
2261+
}
2262+
22522263
ZVAL_UNDEF(&retval);
22532264
if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE, &retval, 1, &zfd)) {
22542265
if (Z_TYPE(retval) != IS_UNDEF) {

0 commit comments

Comments
 (0)