mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-09-23 18:30:21 +00:00
Don't assume, that IContextSource::getWikiPage() always returns a WikiPage object
It could be possible, that the EditFilterMergedContent hook is called from a context, where no WikiPage is possible (e.g. in Special NS). Check for this situation and abort with a debug message, if no WikiPage is available. Bug: T48342 Change-Id: I5305b89817f4c25eb7c3cbb6ee65a4a1f77205b8
This commit is contained in:
parent
f7f4a915aa
commit
c878fb875e
15
Captcha.php
15
Captcha.php
|
@ -598,6 +598,21 @@ class SimpleCaptcha {
|
|||
# The CAPTCHA was already checked and approved
|
||||
return true;
|
||||
}
|
||||
if ( !$context->canUseWikiPage() ) {
|
||||
// we check WikiPage only
|
||||
// try to get an appropriate title for this page
|
||||
$title = $context->getTitle();
|
||||
if ( $title instanceof Title ) {
|
||||
$title = $title->getFullText();
|
||||
} else {
|
||||
// otherwise it's an unknown page where this function is called from
|
||||
$title = 'unknown';
|
||||
}
|
||||
// log this error, it could be a problem in another extension, edits should always have a WikiPage if
|
||||
// they go through EditFilterMergedContent.
|
||||
wfDebug( __METHOD__ . ': Skipped ConfirmEdit check: No WikiPage for title ' . $title );
|
||||
return true;
|
||||
}
|
||||
$page = $context->getWikiPage();
|
||||
if ( !$this->doConfirmEdit( $page, $content, false, true ) ) {
|
||||
if ( $legacyMode ) {
|
||||
|
|
Loading…
Reference in a new issue