Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error in libxml_get_last_error #438

Open
temp opened this issue Feb 19, 2024 · 0 comments
Open

Error in libxml_get_last_error #438

temp opened this issue Feb 19, 2024 · 0 comments

Comments

@temp
Copy link

temp commented Feb 19, 2024

/**
 * Retrieve last error from libxml.
 *
 * @return \LibXMLError Returns a LibXMLError object if there is any error in the
 * buffer, FALSE otherwise.
 * @throws LibxmlException
 *
 */
function libxml_get_last_error(): \LibXMLError
{
    error_clear_last();
    $safeResult = \libxml_get_last_error();
    if ($safeResult === false) {
        throw LibxmlException::createFromPhpError();
    }
    return $safeResult;
}

I guess something got mixed up here. libxml_get_last_error() returns false if no error occurred, but in the safe function this will trigger an Exception.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant