Page MenuHomePhabricator

Cannot access specific page on en.wikisource.org: "Call to a member function exists() on a non-object (boolean)"
Closed, ResolvedPublic

Description

Hi.

I cannot access/delete such a page any longer: https://en.wikisource.org/wiki/Page:Pywikibot_test_page_1/1

My guess is this is due to some change in ProofreadPage Extension since I created the page (which BTW has no image associated).

If I tagged the ticket wrongly, could you please associate the right one?

Thanks

2017-12-03 18:31:32 [WiRDBApAMFcAADz3Io8AAACK] mw1252 enwikisource 1.31.0-wmf.10 exception ERROR: [WiRDBApAMFcAADz3Io8AAACK] /wiki/Page:Pywikibot_test_page_1/1   BadMethodCallException from line 78 of /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/DatabaseIndexForPageLookup.php: Call to a member function exists() on a non-object (boolean) {"exception_id":"WiRDBApAMFcAADz3Io8AAACK","exception_url":"/wiki/Page:Pywikibot_test_page_1/1","caught_by":"mwe_handler"} 
[Exception BadMethodCallException] (/srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/DatabaseIndexForPageLookup.php:78) Call to a member function exists() on a non-object (boolean)
  #0 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/DatabaseIndexForPageLookup.php(48): ProofreadPage\Page\DatabaseIndexForPageLookup->findPossibleIndexTitleBasedOnName(Title)
  #1 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/DatabaseIndexForPageLookup.php(42): ProofreadPage\Page\DatabaseIndexForPageLookup->findIndexTitle(Title)
  #2 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/PageDisplayHandler.php(43): ProofreadPage\Page\DatabaseIndexForPageLookup->getIndexForPageTitle(Title)
  #3 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/PageDisplayHandler.php(102): ProofreadPage\Page\PageDisplayHandler->getImageWidth(Title)
  #4 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/PageViewAction.php(44): ProofreadPage\Page\PageDisplayHandler->buildPageContainerEnd(Title)
  #5 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(499): ProofreadPage\Page\PageViewAction->show()
  #6 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
  #7 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(851): MediaWiki->performRequest()
  #8 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(523): MediaWiki->main()
  #9 /srv/mediawiki/php-1.31.0-wmf.10/index.php(43): MediaWiki->run()
  #10 /srv/mediawiki/w/index.php(3): include(string)
  #11 {main}
``

Event Timeline

Mpaa created this task.Dec 3 2017, 6:29 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 3 2017, 6:29 PM
Reedy updated the task description. (Show Details)

Thanks for reporting this. Please always provide error messages when they exist, and why you cannot access/delete. In this case:

MediaWiki internal error.
Original exception: [WiRCywpAIDgAACjp92EAAABP] 2017-12-03 18:30:35: Fatal exception of type "BadMethodCallException"

No MediaWiki API calls involved, hence removing that project tag.

exception.message:	   	Call to a member function exists() on a non-object (boolean)
exception.trace:
#0 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/DatabaseIndexForPageLookup.php(48): ProofreadPage\Page\DatabaseIndexForPageLookup->findPossibleIndexTitleBasedOnName(Title)
#1 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/DatabaseIndexForPageLookup.php(42): ProofreadPage\Page\DatabaseIndexForPageLookup->findIndexTitle(Title)
#2 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/PageDisplayHandler.php(43): ProofreadPage\Page\DatabaseIndexForPageLookup->getIndexForPageTitle(Title)
#3 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/PageDisplayHandler.php(102): ProofreadPage\Page\PageDisplayHandler->getImageWidth(Title)
#4 /srv/mediawiki/php-1.31.0-wmf.10/extensions/ProofreadPage/includes/page/PageViewAction.php(44): ProofreadPage\Page\PageDisplayHandler->buildPageContainerEnd(Title)
#5 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(499): ProofreadPage\Page\PageViewAction->show()
#6 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
#7 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(851): MediaWiki->performRequest()
#8 /srv/mediawiki/php-1.31.0-wmf.10/includes/MediaWiki.php(523): MediaWiki->main()
#9 /srv/mediawiki/php-1.31.0-wmf.10/index.php(43): MediaWiki->run()
#10 /srv/mediawiki/w/index.php(3): include(string)
#11 {main}
Aklapper renamed this task from Cannot delete Page:Pywikibot_test_page_1/1 on en.wikisource.org to Cannot access specific page on en.wikisource.org: "Call to a member function exists() on a non-object (boolean)".Dec 3 2017, 6:34 PM
Reedy added a subscriber: Reedy.Dec 3 2017, 6:46 PM
	/**
	 * @return Title|null the index page based on the name of the Page: page and the existence
	 *   of a file with the same name
	 */
	private function findPossibleIndexTitleBasedOnName( Title $pageTitle ) {
		$m = explode( '/', $pageTitle->getText(), 2 );
		if ( isset( $m[1] ) ) {
			$imageTitle = Title::makeTitleSafe( NS_FILE, $m[0] );
			if ( $imageTitle !== null ) {
				$image = $this->repoGroup->findFile( $imageTitle );
				// if it is multipage, we use the page order of the file
				if ( $image->exists() && $image->isMultipage() ) {
					return Title::makeTitle(
						$this->indexNamespaceId, $image->getTitle()->getText()
					);
				}
			}
		}
		return null;
	}

Line 78 is

				// if it is multipage, we use the page order of the file
				if ( $image->exists() && $image->isMultipage() ) {

Which means

$image = $this->repoGroup->findFile( $imageTitle );

is returning false (as documented that it will

Swapping

if ( $image->exists() && $image->isMultipage() ) {

for

if ( $image && $image->exists() && $image->isMultipage() ) {

Should be enough?

Change 394861 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/ProofreadPage@master] RepoGroup::findFile() can and will return false

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

Tpt closed this task as Resolved.Dec 3 2017, 9:27 PM
Tpt claimed this task.
Tpt added a subscriber: Tpt.

Change merged! Thank you for the bug report and the fix.

Change 394861 merged by jenkins-bot:
[mediawiki/extensions/ProofreadPage@master] RepoGroup::findFile() can and will return false

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM