Skip to content

Commit e878160

Browse files
committed
Remove incorrect uses of zend_atol()
zend_atol() parses integers with size suffixes (like "128M"). Here zend_atol() is replaced with ZEND_ATOL() when the intent was not to parse a size or quantity. This builds on 989205e and phpGH-4132.
1 parent 98c4a42 commit e878160

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */
146146
{
147147
zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
148148

149-
zend_long val = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
149+
zend_long val = ZEND_ATOL(ZSTR_VAL(new_value));
150150

151151
if (stage != ZEND_INI_STAGE_STARTUP &&
152152
stage != ZEND_INI_STAGE_SHUTDOWN &&

ext/opcache/zend_accelerator_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static ZEND_INI_MH(OnUpdateJit)
165165
static ZEND_INI_MH(OnUpdateJitDebug)
166166
{
167167
zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
168-
zend_long val = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
168+
zend_long val = ZEND_ATOL(ZSTR_VAL(new_value));
169169

170170
if (zend_jit_debug_config(*p, val, stage) == SUCCESS) {
171171
*p = val;

ext/standard/basic_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2505,7 +2505,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal
25052505
}
25062506

25072507
if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
2508-
zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
2508+
zend_ulong key = (zend_ulong) ZEND_STRTOUL(Z_STRVAL_P(arg1), NULL, 0);
25092509
if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) {
25102510
array_init(&hash);
25112511
find_hash = zend_hash_index_add_new(Z_ARRVAL_P(arr), key, &hash);

0 commit comments

Comments
 (0)