SimplePie: Fix int types for enclosures (#8702)

channels, duration were wrongly parsed as string instead of int.

```
PHP Fatal error:  Uncaught TypeError: SimplePie\Enclosure::__construct():
Argument #12 ($duration) must be of type ?int, string given in simplepie/src/Enclosure.php:199
```

And add tests (there were none for those attributes)

fix https://github.com/FreshRSS/FreshRSS/issues/8701

Upstream PR:
* https://github.com/simplepie/simplepie/pull/975
* https://github.com/FreshRSS/simplepie/pull/74
This commit is contained in:
Alexandre Alapetite
2026-04-18 01:15:12 +02:00
committed by GitHub
parent 075101fa66
commit 3d4dca5f5b
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
"marienfressinaud/lib_opml": "0.5.1",
"phpgt/cssxpath": "v1.5.0",
"phpmailer/phpmailer": "7.0.2",
"simplepie/simplepie": "dev-freshrss#731f1a60b8d011238bb5a2cb3b7cdea619e02b94"
"simplepie/simplepie": "dev-freshrss#33e4bcf5685192b0fa4c9819f0813b47c3d22424"
},
"config": {
"sort-packages": true,
+4 -4
View File
@@ -1458,10 +1458,10 @@ class Item implements RegistryAware
$bitrate = $this->sanitize($content['attribs']['']['bitrate'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
}
if (isset($content['attribs']['']['channels'])) {
$channels = $this->sanitize($content['attribs']['']['channels'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
$channels = (int) $this->sanitize($content['attribs']['']['channels'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
}
if (isset($content['attribs']['']['duration'])) {
$duration = $this->sanitize($content['attribs']['']['duration'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
$duration = (int) $this->sanitize($content['attribs']['']['duration'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
} else {
$duration = $duration_parent;
}
@@ -1915,10 +1915,10 @@ class Item implements RegistryAware
$bitrate = $this->sanitize($content['attribs']['']['bitrate'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
}
if (isset($content['attribs']['']['channels'])) {
$channels = $this->sanitize($content['attribs']['']['channels'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
$channels = (int) $this->sanitize($content['attribs']['']['channels'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
}
if (isset($content['attribs']['']['duration'])) {
$duration = $this->sanitize($content['attribs']['']['duration'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
$duration = (int) $this->sanitize($content['attribs']['']['duration'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
} else {
$duration = $duration_parent;
}