Skip to content

Fix GH-22167: reject out-of-range SOAP schema integers#22178

Open
LamentXU123 wants to merge 1 commit into
php:masterfrom
LamentXU123:bug-f-21
Open

Fix GH-22167: reject out-of-range SOAP schema integers#22178
LamentXU123 wants to merge 1 commit into
php:masterfrom
LamentXU123:bug-f-21

Conversation

@LamentXU123
Copy link
Copy Markdown
Contributor

@LamentXU123 LamentXU123 commented May 29, 2026

Fixed #22167

I also add logic to deal with numeric-strings. Now, both 2147483648 and 2147483648abc will not be accepted (also added tests). Other behaviors remain the same.

I don't sure if we can write the helper function in simpler ways using existing Zend API.

Comment thread ext/soap/php_schema.c
}

errno = 0;
lval = ZEND_STRTOL(str, NULL, 10);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reachable if value contains a ., i.e. is a legitimate floating-point value. But parsing this again with ZEND_STRTOL() will silently discard the fractional part. E.g. test with 3.141.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may not want unnecessary bc break, so let's fix it to make it similar to the original behavior in this case (i.e. parse 3.141 returns 3)

@devnexen
Copy link
Copy Markdown
Member

High level note ; I'd target master rather than 8.4. It's a correct change, but it turns input that currently parses (silently truncated by atoi) into a fatal SOAP-ERROR, so a WSDL
that works today could break on a patch release. That kind of stricter parsing belongs in the next minor where we can note it in UPGRADING; on a stable branch it's a
behavior change we'd rather avoid.

@LamentXU123
Copy link
Copy Markdown
Contributor Author

High level note ; I'd target master rather than 8.4. It's a correct change, but it turns input that currently parses (silently truncated by atoi) into a fatal SOAP-ERROR, so a WSDL that works today could break on a patch release. That kind of stricter parsing belongs in the next minor where we can note it in UPGRADING; on a stable branch it's a behavior change we'd rather avoid.

This is rather like a new feature than a bug fix, we have lots of similar fixes before (i.e. rejecting NUL bytes in some functions) targeting the master branch so this should be targeting it too.

@LamentXU123 LamentXU123 marked this pull request as draft May 29, 2026 10:18
@devnexen
Copy link
Copy Markdown
Member

take your time I ll (re)review it saturday at earliest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ext/soap silently accepts out-of-range XML Schema integer values due to atoi()

3 participants