Remove incorrect uses of zend_atoi()

zend_atoi() parses integers with size suffixes (like "128M").
These just want to use a plain number, so use ZEND_ATOL instead.
This commit is contained in:
Nikita Popov 2021-07-12 16:56:00 +02:00
parent efbb2198d4
commit 989205e95c
4 changed files with 6 additions and 7 deletions

View File

@ -896,7 +896,7 @@ void zend_startup(zend_utility_functions *utility_functions) /* {{{ */
{
char *tmp = getenv("USE_ZEND_DTRACE");
if (tmp && zend_atoi(tmp, 0)) {
if (tmp && ZEND_ATOL(tmp)) {
zend_dtrace_enabled = 1;
zend_compile_file = dtrace_compile_file;
zend_execute_ex = dtrace_execute_ex;

View File

@ -2801,8 +2801,8 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
#if ZEND_MM_CUSTOM
tmp = getenv("USE_ZEND_ALLOC");
if (tmp && !zend_atoi(tmp, 0)) {
bool tracked = (tmp = getenv("USE_TRACKED_ALLOC")) && zend_atoi(tmp, 0);
if (tmp && ZEND_ATOL(tmp)) {
bool tracked = (tmp = getenv("USE_TRACKED_ALLOC")) && ZEND_ATOL(tmp);
zend_mm_heap *mm_heap = alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
memset(mm_heap, 0, sizeof(zend_mm_heap));
mm_heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
@ -2827,7 +2827,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
#endif
tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES");
if (tmp && zend_atoi(tmp, 0)) {
if (tmp && ZEND_ATOL(tmp)) {
zend_mm_use_huge_pages = 1;
}
alloc_globals->mm_heap = zend_mm_init();

View File

@ -769,8 +769,7 @@ static PHP_INI_MH(OnUpdateLazyWrite) /* {{{ */
static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
{
int tmp;
tmp = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
int tmp = ZEND_ATOL(ZSTR_VAL(new_value));
if(tmp < 0) {
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to 0");
return FAILURE;

View File

@ -1196,7 +1196,7 @@ int main(int argc, char *argv[])
#if defined(PHP_WIN32) && defined(_DEBUG)
{
char *tmp = getenv("PHP_WIN32_DEBUG_HEAP");
if (tmp && zend_atoi(tmp, 0)) {
if (tmp && ZEND_ATOL(tmp, 0)) {
int tmp_flag;
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);