Skip to content

Commit 9152f3b

Browse files
committed
Use is_numeric_string_ex() to avoid mislabelling numeric strings as non-numeric
1 parent 1b9aaac commit 9152f3b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Zend/zend_API.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ ZEND_API const char *zend_zval_numeric_string_value_name(const zval *arg)
160160
return "empty-string";
161161
}
162162

163+
zend_long lval;
164+
double dval;
165+
166+
if (is_numeric_string_ex(Z_STRVAL_P(val), Z_STRLEN_P(val),&lval, &dval, 0, NULL))
167+
{
168+
return "string";
169+
}
170+
163171
return "non-numeric-string";
164172
}
165173

0 commit comments

Comments
 (0)