Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[VarDumper] Fix error with uninitialized XMLReader#43413
New issue
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedOct 13, 2021
Hey! I think@fancyweb has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
villfa commentedOct 13, 2021
Hi@fabpot, |
Uh oh!
There was an error while loading.Please reload this page.
| 'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE), | ||
| 'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES), | ||
| ]; | ||
| }catch (Error$e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| }catch (Error$e) { | |
| }catch (\ValueError$e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I've usedError instead ofValueError on purpose because of this fix in PHP:php/php-src@53f8921
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
That makes total sense. I can confirm that anError is triggered on the latest PHP snapshot.
That makes me wonder: Is there a better way to detect an uninitializedXMLReader than to catch a genericError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I've double-checked the XMLReaderdocumentation andsource code, and I couldn't find another way to check if an instance is not yet initialized :(
derrabus commentedOct 13, 2021
Thank you for your PR,@villfa. The open source tool that fabbot relies on is PHP CS Fixer. Since the failure is a false positive as you already discovered, you can simply ignore it. 🙂 |
fabpot commentedOct 14, 2021
Thank you@villfa. |
Uh oh!
There was an error while loading.Please reload this page.
When XMLReader is not initialized, getParserProperty() throws an error (or emits a warning, depending on the PHP version).
Now the error is caught and the properties are set to false.