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

spouts\rss\feed: Work around SimplePie returning incorrect date value #1385

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Known regressions
- Values in `config.ini` containing special characters need to be quoted. Will be fixed by <https://github.com/fossar/selfoss/commit/ba9339372a7bc0678c6c1f74336406ab1bbb4ecb>.
- Updating sources that already contain items will fail on PHP < 7.2.0. Will be fixed by <https://github.com/fossar/selfoss/commit/d6e9bc8b01a7d58630772f6dc9938e88a28be706>.
- Updating RSS sources without a valid date fails. Will be fixed by [#1385](https://github.com/fossar/selfoss/pull/1385).

### New features
- Thumbnails can be disabled ([#897](https://github.com/fossar/selfoss/pull/897))
Expand Down
3 changes: 2 additions & 1 deletion src/spouts/rss/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public function getItems() {
$icon = null;
$link = htmlspecialchars_decode((string) $item->get_link(), ENT_COMPAT); // SimplePie sanitizes URLs
$unixDate = $item->get_date('U');
$date = $unixDate !== null ? new \DateTimeImmutable('@' . $unixDate) : new \DateTimeImmutable();
// TODO: remove the `false` check once we upgrade to SimplePie 1.8
$date = $unixDate !== null && $unixDate !== false ? new \DateTimeImmutable('@' . $unixDate) : new \DateTimeImmutable();
$author = $this->getAuthorString($item);

yield new Item(
Expand Down