Page MenuHomePhabricator

PHP Fatal error: Call to a member function exists() on a non-object in maintenance/cleanupTitles.php
Closed, ResolvedPublic

Description

Author: dick.pluim

Description:
I'm getting the following when I try to solve SpecialPages:BadTitle-problem:

root@mediawiki mediawiki/maintenance# php cleanupTitles.php --fix
Checking and fixing bad titles...
Processing page...
page 44 (Trusted) doesn't match self.
renaming 44 (500,'Trusted') to (0,'Trusted')
page 45 (Trusted) doesn't match self.
renaming 45 (3000,'Trusted') to (0,'Trusted')
A database query error has occurred.
Query: UPDATE page SET page_namespace = '0',page_title = 'Trusted' WHERE page_id = '45'
Function: TitleCleanup::moveInconsistentPage
Error: 1062 Duplicate entry '0-Trusted' for key 'name_title' (localhost)

root@mediawiki mediawiki/maintenance# php cleanupTitles.php --fix
Checking and fixing bad titles...
Processing page...
page 45 (Trusted) doesn't match self.
PHP Fatal error: Call to a member function exists() on a non-object in /usr/share/mediawiki/maintenance/cleanupTitles.php on line 153

Actually the first run seems to run OK, but the second run gives the fatal error.
Line 153 shows: if ( $verified->exists() ) {

Happens also on a 1.23.1-installation.


Version: 1.23.1
Severity: normal
OS: Linux

Details

Reference
bz68501

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:29 AM
bzimport set Reference to bz68501.
bzimport added a subscriber: Unknown Object (MLST).

Change 153644 had a related patch set uploaded by IAlex:
Correctly handle incorrect namespace in cleanupTitles.php

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

Change 153644 merged by jenkins-bot:
Correctly handle incorrect namespace in cleanupTitles.php

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

dick.pluim wrote:

Gerrit, thanx. Guess this one will also be fixed in 1.23.3-patchset to be released at the last Wednesday of August. I'll try to grab the patch though to verify it's fixed.

The patch was only merged into git master (=development) branch in Gerrit.
I have now set a "Backport_to_Stable?" request flag here, so maintainers can decide whether it should also be merged into the 1.23.x branch.

dick.pluim wrote:

Ok, thanx.

root@mediawiki mediawiki/maintenance# php cleanupTitles.php -fix
Checking and fixing bad titles...
Processing page...
page 45 (Trusted) doesn't match self.
renaming 45 (3000,'Trusted') to (0,'Broken/Trusted')
mediawiki 2014-08-18 10:30:34: 41.84% done on page; ETA 2014-08-18 10:30:34 [100/239] 760.19/sec <1.00% updated>
mediawiki 2014-08-18 10:30:34: 83.68% done on page; ETA 2014-08-18 10:30:34 [200/239] 1090.63/sec <0.50% updated>
Finished page... 1 of 205 rows updated

Looks better now after manually modifying cleanupTitles.php and adding the changed code to it.

dick.pluim wrote:

In other environment:

root@mediawiki mediawiki/maintenance# php cleanupTitles.php -fix
Checking and fixing bad titles...
Processing page...
page 45 (Trusted) doesn't match self.
renaming 45 (3000,'Trusted') to (0,'Broken/Trusted')
mediawiki 2014-08-18 13:55:15: 23.20% done on page; ETA 2014-08-18 13:55:15 [100/431] 2032.69/sec <1.00% updated>
mediawiki 2014-08-18 13:55:15: 46.40% done on page; ETA 2014-08-18 13:55:15 [200/431] 2719.57/sec <0.50% updated>
mediawiki 2014-08-18 13:55:15: 69.61% done on page; ETA 2014-08-18 13:55:15 [300/431] 3320.24/sec <0.33% updated>
mediawiki 2014-08-18 13:55:15: 92.81% done on page; ETA 2014-08-18 13:55:15 [400/431] 3780.72/sec <0.25% updated>
mediawiki 2014-08-18 13:55:15: 116.01% done on page; ETA 2014-08-18 13:55:15 [500/431] 4098.77/sec <0.20% updated>
Finished page... 1 of 531 rows updated

Weird the 116%. ;-)
Looks another bug (should be 531 instead of 431?).

Change 155305 had a related patch set uploaded by Umherirrender:
Correctly handle incorrect namespace in cleanupTitles.php

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

Change 155305 merged by jenkins-bot:
Correctly handle incorrect namespace in cleanupTitles.php

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

Will also be included in the next 1.23.x release.