From: Jack Phoenix Date: Thu, 25 Dec 2008 18:47:42 +0000 (+0000) Subject: only call pageStats function in Skin::printFooter if $wgArticle is an object. this... X-Git-Tag: 1.31.0-rc.0~43772 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=770201b4e24e29c185d3bed2be21458f66ff0e58;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 */