Skip to content

Commit 234c53a

Browse files
committed
optimization
1 parent 16d949d commit 234c53a

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

ext/soap/php_schema.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,15 @@ static int schema_parse_int(const xmlChar *value, const char *name, bool allow_n
6060
int oflow_info = 0;
6161
uint8_t type = is_numeric_string_ex(str, strlen(str), &lval, NULL, true, &oflow_info, NULL);
6262

63-
if (oflow_info || (type == IS_LONG && ZEND_LONG_EXCEEDS_INT(lval))) {
64-
soap_error1(E_ERROR, "Parsing Schema: %s value is out of range", name);
65-
}
66-
67-
if (type == IS_LONG) {
68-
if (!allow_negative && lval < 0) {
63+
if (type != IS_LONG) {
64+
errno = 0;
65+
lval = ZEND_STRTOL(str, NULL, 10);
66+
if (oflow_info || (errno == ERANGE && lval != 0)) {
6967
soap_error1(E_ERROR, "Parsing Schema: %s value is out of range", name);
7068
}
71-
return (int) lval;
7269
}
7370

74-
errno = 0;
75-
lval = ZEND_STRTOL(str, NULL, 10);
76-
if ((errno == ERANGE && (lval > 0 || lval < 0))
77-
|| ZEND_LONG_EXCEEDS_INT(lval)
78-
|| (!allow_negative && lval < 0)) {
71+
if (ZEND_LONG_EXCEEDS_INT(lval) || (!allow_negative && lval < 0)) {
7972
soap_error1(E_ERROR, "Parsing Schema: %s value is out of range", name);
8073
}
8174

0 commit comments

Comments
 (0)