1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-10-17 01:26:08 +02:00

[GithubIssueBridge] Avoid warning on missing title or number

Some issue "comments" (e.g. changes in labels) lack a title, leading to
an ugly PHP warning:
```
rssbridge.WARNING Attempt to read property "plaintext" on null at bridges/GithubIssueBridge.php line 165
```

This commit checks whether an element was found before accessing
`plaintext` on it, avoiding this specific warning.

Equally, the issue number is checked before access.
This commit is contained in:
Mynacol
2025-09-05 15:49:00 +00:00
parent 5274036108
commit 430ffb4f44

View File

@@ -162,10 +162,18 @@ class GithubIssueBridge extends BridgeAbstract
private function extractIssueComments($issue)
{
$items = [];
$title = $issue->find('.gh-header-title', 0)->plaintext;
$issueNbr = trim(
substr($issue->find('.gh-header-number', 0)->plaintext, 1)
);
$titleElem = $issue->find('.gh-header-title', 0);
$title = $titleElem !== null ? $titleElem->plaintext : '';
$numberElem = $issue->find('.gh-header-number', 0);
if ($numberElem !== null) {
$issueNbr = trim(
substr($numberElem->plaintext, 1)
);
} else {
$issueNbr = '';
}
$comments = $issue->find(
'.comment, .TimelineItem-badge'