diff options
Diffstat (limited to 'main/php_ini.c')
-rw-r--r-- | main/php_ini.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/main/php_ini.c b/main/php_ini.c index 6f4c870d1f..aec25c3f8c 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -409,6 +409,30 @@ PHPAPI void display_ini_entries(zend_module_entry *module) } +PHPAPI int php_atoi(const char *str, int str_len) +{ + int retval; + + if (!str_len) { + str_len = strlen(str); + } + retval = atoi(str); + if (str_len>0) { + switch (str[str_len-1]) { + case 'k': + case 'K': + retval *= 1024; + break; + case 'm': + case 'M': + retval *= 1048576; + break; + } + } + return retval; +} + + /* Standard message handlers */ PHPAPI PHP_INI_MH(OnUpdateBool) @@ -442,7 +466,7 @@ PHPAPI PHP_INI_MH(OnUpdateInt) p = (long *) (base+(size_t) mh_arg1); - *p = atoi(new_value); + *p = php_atoi(new_value, new_value_length); return SUCCESS; } |