Page MenuHomePhabricator

Scribunto Fatal error: Call to a member function getPrefixedText() on a non-object
Closed, ResolvedPublic

Description

[07-Jun-2013 23:21:59] Fatal error: Call to a member function getPrefixedText() on a non-object at /usr/local/apache/common-local/php-1.22wmf5/extensions/Scribunto/common/Hooks.php on line 349
Server: mw1026
Method: GET
URL: http://hu.wikipedia.org/wiki/Doc
Backtrace:
#0 /usr/local/apache/common-local/php-1.22wmf5/extensions/Scribunto/common/Hooks.php(349): ScribuntoHooks::showDocPageHeader()
#1 [internal function]: ScribuntoHooks::showDocPageHeader(Object(Article), false, true)
#2 /usr/local/apache/common-local/php-1.22wmf5/includes/Hooks.php(196): call_user_func_array('ScribuntoHooks:...', Array)
#3 /usr/local/apache/common-local/php-1.22wmf5/includes/GlobalFunctions.php(3834): Hooks::run('ArticleViewHead...', Array)
#4 /usr/local/apache/common-local/php-1.22wmf5/includes/Article.php(615): wfRunHooks('ArticleViewHead...', Array)
#5 /usr/local/apache/common-local/php-1.22wmf5/includes/actions/ViewAction.php(44): Article->view()
#6 /usr/local/apache/common-local/php-1.22wmf5/includes/Wiki.php(439): ViewAction->show()
#7 /usr/local/apache/common-local/php-1.22wmf5/includes/Wiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#8 /usr/local/apache/common-local/php-1.22wmf5/includes/Wiki.php(565): MediaWiki->performRequest()
#9 /usr/local/apache/common-local/php-1.22wmf5/includes/Wiki.php(458): MediaWiki->main()
#10 /usr/local/apache/common-local/php-1.22wmf5/index.php(55): MediaWiki->run()


Version: master
Severity: normal

Details

Reference
bz49322

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:00 AM
bzimport set Reference to bz49322.

public static function showDocPageHeader( &$article, &$outputDone, &$pcache ) {

		global $wgOut;

		$title = $article->getTitle();
		if ( Scribunto::isDocPage( $title, $forModule ) ) {
			$wgOut->addHTML(
				wfMessage( 'scribunto-doc-page-header', $forModule->getPrefixedText() )->parseAsBlock()
			);
		}
		return true;

}

Scribunto::isDocPage() calls Title::makeTitleSafe() which can return null. Even if it returns null, we return true

public static function isDocPage( $title, &$forModule = null ) {

		$docPage = wfMessage( 'scribunto-doc-page-name' )->inContentLanguage();
		if ( $docPage->isDisabled() ) {
			return false;
		}

		// Canonicalize the input pseudo-title. The unreplaced "$1" shouldn't
		// cause a problem.
		$docPage = Title::newFromText( $docPage->plain() )->getPrefixedText();

		// Make it into a regex, and match it against the input title
		$docPage = str_replace( '\\$1', '(.+)', preg_quote( $docPage, '/' ) );
		$forModule = null;
		if ( preg_match( "/^$docPage$/", $title->getPrefixedText(), $m ) ) {
			$forModule = Title::makeTitleSafe( NS_MODULE, $m[1] );
		}
		return $forModule !== null;

}

Change 95408 had a related patch set uploaded by MarkAHershberger:
Handle bogus entries in MediaWiki:Scribunto-doc-page-name

https://gerrit.wikimedia.org/r/95408

Change 95408 abandoned by MarkAHershberger:
Handle bogus entries in MediaWiki:Scribunto-doc-page-name

https://gerrit.wikimedia.org/r/95408

No open patches to review here (backport patches got abandoned), hence resetting status to RESOLVED FIXED. Backport_to_Stable flag might be set to "-" by hexmode.