Add missing isset() check to ApiEchoUnreadNotificationPages

…::getUnreadNotificationPagesFromForeign().

I'm not 100% sure if this fixes the code in a way it is
supposed to work. However, I see that getFromForeign() is
called 3 times in existing code, and 2 of these places
already do an isset() check. It looks like it was just
forgotten here.

Even if there is another issue to fix here, this patch:
a) silences the error, and
b) gives us more useful debug output.

Bug: T273479
Change-Id: I257620f646196c0554b9d86c849a02f5a8b9519c
This commit is contained in:
Thiemo Kreuz 2021-02-02 08:57:44 +01:00 committed by Ammarpad
parent 5b032f5589
commit d8a4b6ba91

View file

@ -171,7 +171,9 @@ class ApiEchoUnreadNotificationPages extends ApiQueryBase {
protected function getUnreadNotificationPagesFromForeign() {
$result = [];
foreach ( $this->getFromForeign() as $wiki => $data ) {
$result[$wiki] = $data['query'][$this->getModuleName()][$wiki];
if ( isset( $data['query'][$this->getModuleName()][$wiki] ) ) {
$result[$wiki] = $data['query'][$this->getModuleName()][$wiki];
}
}
return $result;