Skip to content

Fix max_execution_time with cli-server router script #12886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2249,6 +2249,17 @@ static bool php_cli_server_dispatch_router(php_cli_server *server, php_cli_serve
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) {
Expand Down