Skip to content

feat: add libxml flags parameter to FluidXml::load()#72

Open
guillaumedelre wants to merge 1 commit into
downforcetech:mainfrom
guillaumedelre:fix/issue-52
Open

feat: add libxml flags parameter to FluidXml::load()#72
guillaumedelre wants to merge 1 commit into
downforcetech:mainfrom
guillaumedelre:fix/issue-52

Conversation

@guillaumedelre
Copy link
Copy Markdown

Large XML files (or files served over HTTP) can exceed libxml's default parser limits, causing load() to silently return empty data.

Pass an optional $flags int to load() and forward it to DOMDocument::load(), which lets callers opt into LIBXML_PARSEHUGE, LIBXML_COMPACT, or any other libxml flag as needed.

The implementation also switches from file_get_contents() + loadXML() to DOMDocument::load() directly, which avoids loading the whole file into a PHP string before parsing.

Closes #52

Large XML files (or files served over HTTP) can exceed libxml's default
parser limits, causing load() to silently return empty data.

Pass an optional $flags int to load() and forward it to
DOMDocument::load(), which lets callers opt into LIBXML_PARSEHUGE,
LIBXML_COMPACT, or any other libxml flag as needed.

The implementation also switches from file_get_contents() + loadXML()
to DOMDocument::load() directly, which avoids loading the whole file
into a PHP string before parsing.

Closes downforcetech#52

Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>
@guillaumedelre
Copy link
Copy Markdown
Author

Hey @daniele-orlando, this PR fixes #52 — happy to adjust if anything looks off.

@guillaumedelre
Copy link
Copy Markdown
Author

Hey @daniele-orlando, just a ping here. Happy to discuss the approach if you have concerns.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loading a valid XML from a URL gives empty data

1 participant