So far I've encountered 2 extensions that give fatal errors from calling $wgParser->disableOutput() from hooks that are called at points where parsing is not taking place! Exception with a backtrace is much nicer than "Fatal error: Call to a member function disableCache() on a non-object..."
*/
function disableCache() {
wfDebug( "Parser output marked as uncacheable.\n" );
+ if ( !$this->mOutput ) {
+ throw new MWException( __METHOD__ .
+ " can only be called when actually parsing something" );
+ }
$this->mOutput->setCacheTime( -1 ); // old style, for compatibility
$this->mOutput->updateCacheExpiry( 0 ); // new style, for consistency
}