r45038 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45037‎ | r45038 | r45039 >
Date:18:47, 25 December 2008
Author:ashley
Status:reverted (Comments)
Tags:
Comment:
only call pageStats function in Skin::printFooter if $wgArticle is an object. this might not always be the case (tested with a custom skin extending the Skin class) and if so, a fatal error is shown on the page (tested with Special: pages) and footer won't be rendered
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -917,8 +917,13 @@
918918 }
919919
920920 function printFooter() {
 921+ global $wgArticle;
 922+ // Under certain conditions, $wgArticle might not be an object which would cause a fatal error like this:
 923+ // Fatal error: Call to a member function getID() on a non-object in ../includes/Skin.php on line 1270
 924+ // To prevent this, we'll check first if $wgArticle is an object and if that's the case, then we'll load the page stats.
 925+ $stats = ( is_object( $wgArticle ) ? "<p>" . $this->pageStats() . "</p>\n" : '' );
921926 return "<p>" . $this->printSource() .
922 - "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
 927+ "</p>\n\n" . $stats;
923928 }
924929
925930 /** overloaded by derived classes */

Follow-up revisions

RevisionCommit summaryAuthorDate
r45204Revert r45038 "only call pageStats function in Skin::printFooter if $wgArticl...brion21:34, 30 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   21:34, 30 December 2008

Reverted in r45204

Status & tagging log