PHP8: SimplePie wrong use of isset#3404
Merged
Alkarex merged 4 commits intoFreshRSS:masterfrom Jan 31, 2021
Merged
Conversation
#fix FreshRSS#3401 Use `!empty` instead to properly handle falsy values such as empty string, 0, false, null. While 0 would be grammatically fine, it does not make sense for a media length or height, or width or framerate or bitrate
Member
Author
|
Patch sent upstream simplepie/simplepie#670 |
Alkarex
commented
Jan 29, 2021
lib/SimplePie/SimplePie/Item.php
Outdated
| if (isset($enclosure[0]['attribs']['']['length'])) | ||
| if (!empty($enclosure[0]['attribs']['']['length'])) | ||
| { | ||
| $length = ceil($enclosure[0]['attribs']['']['length']); |
Member
Author
There was a problem hiding this comment.
Here was the actual crash with PHP8+
Member
Author
|
Merged upstream |
Alkarex
added a commit
to Alkarex/FreshRSS
that referenced
this pull request
Feb 20, 2021
Follow-up of FreshRSS#3206 (1.5.5) Differences simplepie/simplepie@692e8bc...155cfcf Related to FreshRSS#3416 , FreshRSS#3404
Alkarex
added a commit
that referenced
this pull request
Feb 20, 2021
* Manual update to SimplePie 1.5.6 Follow-up of #3206 (1.5.5) Differences simplepie/simplepie@692e8bc...155cfcf Related to #3416 , #3404 * Typo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#fix #3401 (crash with PHP 8+)
ceil()crashes in PHP8+ in case of invalid input such as empty string.intval()fixes the problem with almost identical behaviour thanceil()in PHP7- (except for floating point values)#fix #3401 (crash with PHP 8+)
Example with feed http://podcast.hr2.de/derTag/podcast.xml
isset("")passes and thenceil("")crashes due to wrong type in PHP8+: