only call pageStats function in Skin::printFooter if $wgArticle is an object. this...
authorJack Phoenix <ashley@users.mediawiki.org>
Thu, 25 Dec 2008 18:47:42 +0000 (18:47 +0000)
committerJack Phoenix <ashley@users.mediawiki.org>
Thu, 25 Dec 2008 18:47:42 +0000 (18:47 +0000)
includes/Skin.php

index f4744dc..e04f877 100644 (file)
@@ -917,8 +917,13 @@ END;
        }
 
        function printFooter() {
+               global $wgArticle;
+               // Under certain conditions, $wgArticle might not be an object which would cause a fatal error like this:
+               // Fatal error: Call to a member function getID() on a non-object in ../includes/Skin.php on line 1270
+               // 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.
+               $stats = ( is_object( $wgArticle ) ? "<p>" . $this->pageStats() . "</p>\n" : '' );
                return "<p>" .  $this->printSource() .
-                       "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
+                       "</p>\n\n" . $stats;
        }
 
        /** overloaded by derived classes */