1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-10-25 21:46:10 +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) private function extractIssueComments($issue)
{ {
$items = []; $items = [];
$title = $issue->find('.gh-header-title', 0)->plaintext;
$issueNbr = trim( $titleElem = $issue->find('.gh-header-title', 0);
substr($issue->find('.gh-header-number', 0)->plaintext, 1) $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( $comments = $issue->find(
'.comment, .TimelineItem-badge' '.comment, .TimelineItem-badge'