Last modified: 2008-08-29 22:43:44 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 T14307, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12307 - Check if $wgDBname exists
Check if $wgDBname exists
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
All All
: Lowest minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-14 23:13 UTC by Dan Jacobson
Modified: 2008-08-29 22:43 UTC (History)
1 user (show)

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


Attachments

Description Dan Jacobson 2007-12-14 23:13:07 UTC
In LocalSettings.php make $wgDBname='SomeNonExistentDatabaseName';
Now browse http://your.wiki/
You will get this cryptic error:
  Fatal error: Call to a member function selectRow() on a non-object in
  /var/lib/mediawiki-1.11.0/includes/User.php on line 759

The program probably never expected all to go well except for $wgDBname.

It would be much better to do some error checking and say "$wgDBname
problem" instead of letting get all the way to that point, saying
"Can't get into room 1403", when in fact the problem is really
"Entire State of Louisiana gone."
Comment 1 Antoine "hashar" Musso (WMF) 2007-12-21 18:46:38 UTC
When setting $wgDBname = 'bug12307'; I got a clean error message:

--------------------------------------------------------------------------
MediaWikiDev has a problem

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

(Can't contact the database server: Access denied for user 'xxxxx'@'localhost' to database 'bug12307' (localhost))
--------------------------------------------------------------------------

That's with current 1.10, 1.11 and trunk branch.
Comment 2 Dan Jacobson 2007-12-21 21:37:16 UTC
Me too now. Odd. Closing.
Comment 3 Dan Jacobson 2007-12-23 00:40:33 UTC
Now I half remember what I was doing. I had changed the name of the
database not in LocalSettings.php, but instead in mysql, without
restarting mysql, or even by the wrong method of
$ mv db1 db2
OK, sorry for thinking this was the same as pointing 
$wgDBname to the wrong database.
Comment 4 Dan Jacobson 2007-12-27 23:57:11 UTC
OK, I found out what is going on and hereby restate the bug:

I discovered a very interesting error, here offline on my simulated Internet.
I used tcpflow to capture traffic.
First remove your mysql server from the DNS, causing

   $ http_proxy= w3m -dump http://transgender-taiwan.org/
   [transgende]蝶園 has a problem

   Sorry! This site is experiencing technical difficulties.

   Try waiting a few minutes and reloading.

   (Can't contact the database server: Unknown MySQL server host
   'mysql.transgender-taiwan.org' (4) (mysql.transgender-taiwan.org))

The above is expected and proper.
Note that the HTTP headers I sent causing the above did NOT any cookies.

Now try again with a browser that sends cookies
   Cookie2: $Version="1"
   Cookie: transgender_wiki_UserID=2; transgender_wiki_UserName=Jidanni

  $ http_proxy= lynx -dump http://transgender-taiwan.org/
                              蝶園 has a problem

   Fatal error: Call to a member function selectRow() on a non-object in
   /var/lib/mediawiki-1.11.0/includes/User.php on line 759

So the bug is: Mediawiki sees the cookies, and being hungry, skips its
usual health check, gobbles them down without chewing first, and pukes
out the contents of its guts embarrassingly. So we see we eat cookies
too fast, skipping the stomach, directly to the large intestine.

(Anyways, to restore normal operations I then at this point do
# pdnsd-ctl add cname localhost mysql.transgender-taiwan.org)
Comment 5 Antoine "hashar" Musso (WMF) 2008-08-29 22:43:44 UTC
Seriously, I cant reproduce the problem. I always get the clean error message.

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


Navigation
Links