Last modified: 2010-05-15 15:48:31 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 T11421, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9421 - Division by zero in SpecialStatistics.php
Division by zero in SpecialStatistics.php
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
PC Linux
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2007-03-26 18:23 UTC by Dan Jacobson
Modified: 2010-05-15 15:48 UTC (History)
0 users

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


Description Dan Jacobson 2007-03-26 18:23:22 UTC
$ w3m -dump \ |
head -3

Warning: Division by zero in ...SpecialStatistics.php on line 53
Comment 1 Rob Church 2007-03-26 23:15:44 UTC
Please state the value of site_stats.ss_users; I'm guessing it will be zero.
This sounds like another "messed up statistics table" bug.
Comment 2 Dan Jacobson 2007-03-29 23:23:07 UTC
Must be 0 I suppose too. Maybe I will check it when I supposedly get ADSL.

Moral of story: always check for 0 before dividing external items anyway!
Comment 3 Dan Jacobson 2007-04-07 04:31:36 UTC
Well, it turns out there is nothing there:
-- Dumping data for table `wiki_site_stats`
/*!40000 ALTER TABLE `wiki_site_stats` DISABLE KEYS */;
LOCK TABLES `wiki_site_stats` WRITE;
/*!40000 ALTER TABLE `wiki_site_stats` ENABLE KEYS */;

So at least be prepared for that possibility when writing the code.
Hmmm, how shall I medicate that condition best?

By the way, here are some other wiki observations that I hope your
code is prepared for: ss_admins: -1 ss_images: 0 ss_good_articles:
Comment 4 Rob Church 2007-04-07 04:38:57 UTC
You can run maintenance/initStats.php to initialise the site_stats table, or
indeed, reset the whole thing if it turns bad.

Checking for a missing or invalid site_stats row appears to have been added in

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