diff options
| author | Felipe Pena <felipe@php.net> | 2008-07-25 13:46:56 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2008-07-25 13:46:56 +0000 |
| commit | 05834fc510d3b9e433db6aa9338084a1b2103792 (patch) | |
| tree | 54d7394da7f01bfd1522b9838e4632799e6df2c7 | |
| parent | 281352fe023e30fea30af60adda3b69acd70bd46 (diff) | |
| download | php-git-05834fc510d3b9e433db6aa9338084a1b2103792.tar.gz | |
- MFB: Fixed the parameter type expected. set_time_limit() should accept only integer.
| -rw-r--r-- | main/main.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/main/main.c b/main/main.c index 2501a98418..d1e56b76da 100644 --- a/main/main.c +++ b/main/main.c @@ -1028,23 +1028,27 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ Sets the maximum time a script can run */ PHP_FUNCTION(set_time_limit) { - zval **new_timeout; + long new_timeout; + char *new_timeout_str; + int new_timeout_strlen; if (PG(safe_mode)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot set time limit in safe mode"); RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &new_timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { return; } + + new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, "%ld", new_timeout); - convert_to_string_ex(new_timeout); - if (zend_alter_ini_entry_ex("max_execution_time", sizeof("max_execution_time"), Z_STRVAL_PP(new_timeout), Z_STRLEN_PP(new_timeout), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { - RETURN_TRUE; + if (zend_alter_ini_entry_ex("max_execution_time", sizeof("max_execution_time"), new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { + RETVAL_TRUE; } else { - RETURN_FALSE; + RETVAL_FALSE; } + efree(new_timeout_str); } /* }}} */ |
