We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplexml_load_string will not return false, but will emits errors unless you are setting libxml_use_internal_errors(true); before.
simplexml_load_string
libxml_use_internal_errors(true);
I am not sure this is necessarly something you want to handle. 🤔
To me that kind of looks like an encapsulation issue: I expect the library to get care of those details and provide me an exception.
Instead I've got to do all that by myself:
try { libxml_use_internal_errors(true); $result = \Safe\simplexml_load_string($data, $class_name, $options, $namespace_or_prefix, $is_prefix); libxml_clear_errors(); return $result; } catch (SimplexmlException $e) { $messages = []; foreach (libxml_get_errors() as $error) { $messages[] = $error->message; } libxml_clear_errors(); $message = 'Impossible to process the provided XML: '.join(', ', $messages); throw new SimplexmlException($message, $e); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
simplexml_load_string
will not return false, but will emits errors unless you are settinglibxml_use_internal_errors(true);
before.I am not sure this is necessarly something you want to handle. 🤔
To me that kind of looks like an encapsulation issue: I expect the library to get care of those details and provide me an exception.
Instead I've got to do all that by myself:
The text was updated successfully, but these errors were encountered: