Skip to content

Commit 2b6f5ee

Browse files
committed
Drop Hex support in numeric strings for Intl collator
Support for this was removed in PHP 7.0. See: https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings
1 parent 8ff2f2f commit 2b6f5ee

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

ext/intl/collator/collator_is_numeric.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,13 @@ zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, dou
212212
zend_long local_lval;
213213
double local_dval;
214214
UChar *end_ptr_long, *end_ptr_double;
215-
int conv_base=10;
216215

217216
if (!length) {
218217
return 0;
219218
}
220219

221-
/* handle hex numbers */
222-
if (length>=2 && str[0]=='0' && (str[1]=='x' || str[1]=='X')) {
223-
conv_base=16;
224-
}
225-
226220
errno=0;
227-
local_lval = collator_u_strtol(str, &end_ptr_long, conv_base);
221+
local_lval = collator_u_strtol(str, &end_ptr_long, 10);
228222
if (errno != ERANGE) {
229223
if (end_ptr_long == str+length) { /* integer string */
230224
if (lval) {
@@ -238,11 +232,6 @@ zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, dou
238232
end_ptr_long = NULL;
239233
}
240234

241-
if (conv_base == 16) { /* hex string, under UNIX strtod() messes it up */
242-
/* UTODO: keep compatibility with is_numeric_string() here? */
243-
return 0;
244-
}
245-
246235
local_dval = collator_u_strtod(str, &end_ptr_double);
247236
if (local_dval == 0 && end_ptr_double == str) {
248237
end_ptr_double = NULL;

0 commit comments

Comments
 (0)