exception: Add missing early return for UserNotLoggedIn error page
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 23 Sep 2019 23:33:20 +0000 (00:33 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 23 Sep 2019 23:33:20 +0000 (00:33 +0100)
commitebee381c23403f1d3b2e2bc40df979edcb30bab2
tree23e95839222088e8ac48a9b361068500a5e55d57
parent9e8439e79d67788916d488f645108f79016d9aca
exception: Add missing early return for UserNotLoggedIn error page

Follows-up d0439af89f6b254c.

If the UserNotLoggedIn class is constructed with an unsupported
message parameter, thrown, and handled by MWExceptionHandler, the
report() method would get called, and it would call the parent,
which stages a full error page and sends it via OutputPage::output.

Due to the missing return statement, it would then still execute
the remaining code, which messes up the internal state of the
already-sent OutputPage object by changing its redirect target
(which will never be used, but might confuse other consumers),
and trying to re-send output() and redirect headers, which will
fail with a warning.

Fixing this is required for T233594 and Iaeaf5e55a586, which allows
ErrorPageError to be "stage only" without ending output. Without
this fix, it would call the parent and do stage-only, but then
the remaining code in this method also work and actually succeed
at sending an invalid message to the user.

To preserve current (accidentally correct) behaviour, this needs
to be fixed first.

Bug: T233594
Bug: T17484
Change-Id: Ic5d73becd889839399a5b425cbbe22a3401acea9
includes/exception/UserNotLoggedIn.php