Reject embedded NUL in SimpleXMLElement path/URL constructor - #23069
Open
iliaal wants to merge 1 commit into
Open
Reject embedded NUL in SimpleXMLElement path/URL constructor#23069iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
When dataIsURL is true, __construct parsed the path as a plain string and passed it to xmlReadFile, so an embedded NUL truncated the path. simplexml_load_file already rejects NULs via the path parameter type. Match that check before xmlReadFile. Closes phpGH-23069
iliaal
force-pushed
the
fix/sxe-ctor-nul-path
branch
from
August 5, 2026 13:28
49c4d81 to
3f8efc2
Compare
Member
|
should target master (thus no more CHECK_NULL_PATH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With dataIsURL set, SimpleXMLElement::__construct hands its first argument to xmlReadFile as a C string, so
new SimpleXMLElement("/tmp/ok.xml\0anything", 0, true)quietly loads /tmp/ok.xml. simplexml_load_file already rejects this because its filename parameter is declared as a path; the constructor takes a plain string and never runs the check. The constructor now throws the same ValueError before reaching xmlReadFile.