From 770201b4e24e29c185d3bed2be21458f66ff0e58 Mon Sep 17 00:00:00 2001 From: Jack Phoenix Date: Thu, 25 Dec 2008 18:47:42 +0000 Subject: [PATCH] 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 --- includes/Skin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/Skin.php b/includes/Skin.php index f4744dc1c7..e04f8770e4 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -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 ) ? "

" . $this->pageStats() . "

\n" : '' ); return "

" . $this->printSource() . - "

\n\n

" . $this->pageStats() . "

\n"; + "

\n\n" . $stats; } /** overloaded by derived classes */ -- 2.20.1