safe icon indicating copy to clipboard operation
safe copied to clipboard

Error in libxml_get_last_error

Open temp opened this issue 2 years ago • 0 comments

/**
 * 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.

temp avatar Feb 19 '24 10:02 temp