X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=c0a648c7d4afcfaafd8ed744b0753df34d73344e;hp=b3e37a46c3f76f1502fd0e68f48bd79fb4071345;hb=43c13e73049047842837d837bb3537f1c550a0a4;hpb=b77e101acbba77fa80db8b166287bcdf81534e80 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index b3e37a46c3..c0a648c7d4 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -245,7 +245,7 @@ class Parser { public $currentRevisionCache; /** - * @var bool Recursive call protection. + * @var bool|string Recursive call protection. * This variable should be treated as if it were private. */ public $mInParse = false; @@ -3261,6 +3261,8 @@ class Parser { . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text() . ''; $this->addTrackingCategory( 'template-loop-category' ); + $this->mOutput->addWarning( wfMessage( 'template-loop-warning', + wfEscapeWikiText( $titleText ) )->text() ); wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" ); } } @@ -4974,6 +4976,7 @@ class Parser { $ig->setContextTitle( $this->mTitle ); $ig->setShowBytes( false ); + $ig->setShowDimensions( false ); $ig->setShowFilename( false ); $ig->setParser( $this ); $ig->setHideBadImages(); @@ -6072,9 +6075,13 @@ class Parser { protected function lock() { if ( $this->mInParse ) { throw new MWException( "Parser state cleared while parsing. " - . "Did you call Parser::parse recursively?" ); + . "Did you call Parser::parse recursively? Lock is held by: " . $this->mInParse ); } - $this->mInParse = true; + + // Save the backtrace when locking, so that if some code tries locking again, + // we can print the lock owner's backtrace for easier debugging + $e = new Exception; + $this->mInParse = $e->getTraceAsString(); $recursiveCheck = new ScopedCallback( function() { $this->mInParse = false;