- if ( isset( $this->data[$this->tempType][$m[1]] ) ) {
- return $this->data[$this->tempType][$m[1]];
+ $marker = $m[1];
+ if ( isset( $this->data[$this->tempType][$marker] ) ) {
+ if ( isset( $this->circularRefGuard[$marker] ) ) {
+ return '<span class="error">'
+ . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text()
+ . '</span>';
+ }
+ if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
+ return '<span class="error">' .
+ wfMessage( 'parser-unstrip-recursion-limit' )
+ ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
+ '</span>';
+ }
+ $this->circularRefGuard[$marker] = true;
+ $this->recursionLevel++;
+ $ret = $this->unstripType( $this->tempType, $this->data[$this->tempType][$marker] );
+ $this->recursionLevel--;
+ unset( $this->circularRefGuard[$marker] );
+ return $ret;