Page MenuHomePhabricator

calling tableExists breaks fetchObject
Closed, ResolvedPublic

Description

Tried to run populateFuzzy.php on twn and got:

/www/w/extensions/Translate/scripts$ b php populateFuzzy.php
0/2734323
Error in fetchObject(): Table 'mediawiki.bw_revtag_type' doesn't exist (localhost)


Version: 1.20.x
Severity: normal

Details

Reference
bz39287

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:45 AM
bzimport added a project: Wikimedia-Rdbms.
bzimport set Reference to bz39287.
bzimport added a subscriber: Unknown Object (MLST).

Why are you trying to run that script?

Minimal test case:

$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page', '*', array(), array( 'LIMIT' => 2 ) );
foreach ( $res as $row ) { $dbr->tableExists( 'foo' ); }

Error in fetchObject(): Table 'sandwiki.bw_foo' doesn't exist (localhost)

PS: Could the error message also include class name?

(In reply to comment #1)

Why are you trying to run that script?

To fuzzy some messages in Freecol that hadn't been fuzzier when they should have been, so I sometimes run this script to have checks done on all translations.

The reason for this is because mysql_fetch_object() does not reset the error number when it is successful (blame MySQL, not PHP). Added a patch that only checks for certain errors that are expected from mysql_fetch_*

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