Skip to content

Clear the libxml last error in libxml_use_internal_errors(false) - #24295

Closed
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:fix/libxml-use-internal-errors-clear-last-error
Closed

lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:fix/libxml-use-internal-errors-clear-last-error

Conversation

@lacatoire

Copy link
Copy Markdown
Member

libxml_use_internal_errors(false) destroyed the internal error list but left libxml's own last error in place. libxml_get_last_error() falls back to it once the list is gone, so it kept returning an error while libxml_get_errors() was empty, although the documentation says that disabling clears the existing errors.

Reset the last error when the list is destroyed. Calling the function again while the internal errors are already disabled leaves it alone.

libxml_use_internal_errors(false) destroyed the internal error list but
left libxml's own last error in place. libxml_get_last_error() falls
back to it once the list is gone, so it kept returning an error while
libxml_get_errors() was empty, although the documentation says that
disabling clears the existing errors.

Reset the last error when the list is destroyed. Calling the function
again while the internal errors are already disabled leaves it alone.
@ndossche ndossche closed this in b2163be Oct 14, 2026
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.

2 participants