Last modified: 2010-05-15 15:38:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T6018, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 4018 - wfGetDB function contains extra character
wfGetDB function contains extra character
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
All Windows XP
: Normal blocker (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2005-11-17 21:10 UTC by snpduke
Modified: 2010-05-15 15:38 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description snpduke 2005-11-17 21:10:20 UTC
After downloading 1.5.2 on 2005-11-17 and when going through upgrade from
previous version, upgrade halted complaining that the wfGetDB function was not
defined.  After tracing the problem, found that wfGetDB was defined in
includes/DatabaseFunctions.php on line 50 as

function &wfGetDB( $db = DB_LAST, $groups = array() ) {

(notice the extra '&' before the function name)

After removing this character, upgrade was successful.
Comment 1 Ævar Arnfjörð Bjarmason 2005-11-17 21:14:33 UTC
That function is supposed to return a reference and changing it to not do so
could result in some unexpected behaviour.

What's your setup like?
Comment 2 snpduke 2005-11-17 21:45:57 UTC
bsd platform , mysql db host, all mediawiki defaults

The call to the wfGetDB function on line 46 of maintenance/ :

$dbw =& wfGetDB( DB_MASTER );

is where the update halted the first time through. 

I'm not as familiar with the symantics of php, but I cannot find any
documentation online describing a function definition requiring knowledge of a
reference return-value in this manner.  The reference in the assignment appears
to make sense, but I can't make sense of an ampersand in the definition.  Can
you point me at some docs that describe what this does?
Comment 3 Brion Vibber 2005-11-18 04:48:35 UTC
Go to and look up 'references'.

Note You need to log in before you can comment on or make changes to this bug.