Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error in Version 2.2.3, Calling member function attributes() on a Bool #184

Closed
1 task done
metashield-ie opened this issue Mar 22, 2024 · 4 comments · Fixed by #186
Closed
1 task done

Fatal Error in Version 2.2.3, Calling member function attributes() on a Bool #184

metashield-ie opened this issue Mar 22, 2024 · 4 comments · Fixed by #186
Assignees
Labels
type:bug Something isn't working.
Milestone

Comments

@metashield-ie
Copy link

Describe the bug

In version 2.2.3, Line 598 of safe-svg.php calls the function simplexml_load_file($svg), which may return false. On line 600, it blindly calls $svg->attributes(); which results in a fatal error if simple xml has returned false;

Steps to Reproduce

Fatal Error after simplexml_load_file($svg). Version 2.2.3.

Screenshots, screen recording, code snippet

No response

Environment information

All

WordPress information

WordPress 6.4.3

Code of Conduct

  • I agree to follow this project's Code of Conduct
@metashield-ie metashield-ie added the type:bug Something isn't working. label Mar 22, 2024
@ocean90
Copy link
Contributor

ocean90 commented Mar 25, 2024

Introduced by #154 which shipped in 2.2.3.

@dkotter
Copy link
Collaborator

dkotter commented Mar 25, 2024

Thanks for the report. I can see we lost an if statement in the refactoring done in #154. I've opened #186 to address this but would appreciate if you could test this, as I've not been able to reproduce the scenario where we have a valid svg file but simplexml_load_file can't load it. Thanks!

@dkotter dkotter self-assigned this Mar 25, 2024
@dkotter dkotter added this to the 2.3.0 milestone Mar 25, 2024
@ocean90
Copy link
Contributor

ocean90 commented Mar 25, 2024

You should be able to reproduce this by uploading a SVG file and then deleting the file from the disk directly not using WordPress.

In our case we noticed this in a local dev environment where all uploads are loaded from remote so we don't need to copy them too.

@dkotter
Copy link
Collaborator

dkotter commented Mar 25, 2024

@ocean90 Thanks, took me a bit to reproduce but was finally able to (had to delete the file and ensure we didn't have height and width stored in the metadata). It seems PR #186 does fix this but would still love confirmation from a more real-world scenario.

@github-project-automation github-project-automation bot moved this from Incoming to Merged in Open Source Practice Mar 26, 2024
@dkotter dkotter modified the milestones: 2.3.0, 2.2.4 Mar 26, 2024
@vikrampm1 vikrampm1 moved this from Merged to Done/Released in Open Source Practice Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants