Skip to content
Merged
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
18 changes: 5 additions & 13 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,24 +1577,16 @@ PHPAPI char *php_get_current_user(void)
PHP_FUNCTION(set_time_limit)
{
zend_long new_timeout;
char *new_timeout_str;
size_t new_timeout_strlen;
zend_string *key;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &new_timeout) == FAILURE) {
RETURN_THROWS();
}

new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout);

key = ZSTR_INIT_LITERAL("max_execution_time", 0);
if (zend_alter_ini_entry_chars_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == SUCCESS) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
zend_string_release_ex(key, 0);
efree(new_timeout_str);
zend_string *time = zend_long_to_str(new_timeout);
zend_string *key = ZSTR_INIT_LITERAL("max_execution_time", false);
RETVAL_BOOL(zend_alter_ini_entry_ex(key, time, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, false) == SUCCESS);
zend_string_release_ex(key, false);
zend_string_release_ex(time, false);
}
/* }}} */

Expand Down