Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/209637
Change subject: Don't assume, that IContextSource::getWikiPage() always returns a WikiPage object ...................................................................... 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 --- M Captcha.php 1 file changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit refs/changes/37/209637/1 diff --git a/Captcha.php b/Captcha.php index 2426eed..3d27595 100644 --- a/Captcha.php +++ b/Captcha.php @@ -598,6 +598,21 @@ # 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 ) { -- To view, visit https://gerrit.wikimedia.org/r/209637 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5305b89817f4c25eb7c3cbb6ee65a4a1f77205b8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ConfirmEdit Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits