From 4d15d532598134bdc659ab4cee469d2f2025fecd Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 8 Feb 2013 16:38:41 +1100 Subject: [PATCH] Weaken the recursion guard on RequestContext::getLanguage() Just log and soldier on, since for some reason we are seeing a lot of these exceptions at the moment, with multiple root causes. Based on Matt Walker's I49dbc2d7. Updates Idc11b547. See bug 44754. Change-Id: I2e8c062741c1b2ec2acd68dc76d3fb6efb113571 --- includes/context/RequestContext.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 96d27b001f..09cb409f65 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -278,10 +278,14 @@ class RequestContext implements IContextSource { */ public function getLanguage() { if ( isset( $this->recursion ) ) { - throw new MWException( 'Recursion detected' ); - } - - if ( $this->lang === null ) { + trigger_error( "Recursion detected in " . __METHOD__, E_USER_WARNING ); + $e = new Exception; + wfDebugLog( 'recursion-guard', "Recursion detected:\n" . $e->getTraceAsString() ); + + global $wgLanguageCode; + $code = ( $wgLanguageCode ) ? $wgLanguageCode : 'en'; + $this->lang = Language::factory( $code ); + } elseif ( $this->lang === null ) { $this->recursion = true; global $wgLanguageCode, $wgContLang; -- 2.20.1