Skip to content

Commit a733b1a

Browse files
committed
Restore zend_atoi()
I dropped this in preparation for changes that I didn't end up doing. Restore the function for now to avoid unnecessary churn for extensions.
1 parent bf40a93 commit a733b1a

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

UPGRADING.INTERNALS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ PHP 8.1 INTERNALS UPGRADE NOTES
4444
implementations. Use ZEND_LONG_FMT and ZEND_ULONG_FMT instead.
4545
e. ZEND_ATOL() now returns the integer instead of assigning it as part of the
4646
macro. Replace ZEND_ATOL(i, s) with i = ZEND_ATOL(s).
47-
f. zend_atoi() has been removed. It is identical to (int) zend_atol(). Please
48-
note that zend_atol() parses an integer with size suffix. If you just want
49-
to parse a simple integer use ZEND_ATOL() or ZEND_STRTOL().
5047

5148
========================
5249
2. Build system changes

Zend/zend_operators.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* {
123123
}
124124
/* }}} */
125125

126+
ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len)
127+
{
128+
return (int) zend_atol(str, str_len);
129+
}
130+
126131
/* {{{ convert_object_to_type: dst will be either ctype or UNDEF */
127132
#define convert_object_to_type(op, dst, ctype) \
128133
ZVAL_UNDEF(dst); \

Zend/zend_operators.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable
458458
ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2);
459459
ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2);
460460

461+
ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len);
461462
ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len);
462463

463464
#define convert_to_null_ex(zv) convert_to_null(zv)

ext/zlib/zlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
12781278
} else if (zend_string_equals_literal_ci(new_value, "on")) {
12791279
int_value = 1;
12801280
} else {
1281-
int_value = (int) zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
1281+
int_value = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
12821282
}
12831283
ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);
12841284

0 commit comments

Comments
 (0)