dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
74886b1
)
* Corrections to template loop detection
author
Brion Vibber
<brion@users.mediawiki.org>
Fri, 11 Feb 2005 09:02:15 +0000
(09:02 +0000)
committer
Brion Vibber
<brion@users.mediawiki.org>
Fri, 11 Feb 2005 09:02:15 +0000
(09:02 +0000)
includes/Parser.php
patch
|
blob
|
history
diff --git
a/includes/Parser.php
b/includes/Parser.php
index
0e3549c
..
50777f4
100644
(file)
--- a/
includes/Parser.php
+++ b/
includes/Parser.php
@@
-1991,20
+1991,25
@@
class Parser
# Did we encounter this template already? If yes, it is in the cache
# and we need to check for loops.
if ( !$found && isset( $this->mTemplates[$part1] ) ) {
# Did we encounter this template already? If yes, it is in the cache
# and we need to check for loops.
if ( !$found && isset( $this->mTemplates[$part1] ) ) {
- # set $text to cached message.
- $text = $linestart . $this->mTemplates[$part1];
$found = true;
# Infinite loop test
if ( isset( $this->mTemplatePath[$part1] ) ) {
$noparse = true;
$found = true;
$found = true;
# Infinite loop test
if ( isset( $this->mTemplatePath[$part1] ) ) {
$noparse = true;
$found = true;
- $text .= '<!-- WARNING: template loop detected -->';
+ $text = $linestart .
+ "\{\{$part1}}" .
+ '<!-- WARNING: template loop detected -->';
+ wfDebug( "$fname: template loop broken at '$part1'\n" );
+ } else {
+ # set $text to cached message.
+ $text = $linestart . $this->mTemplates[$part1];
}
}
# Load from database
$itcamefromthedatabase = false;
}
}
# Load from database
$itcamefromthedatabase = false;
+ $lastPathLevel = $this->mTemplatePath;
if ( !$found ) {
$ns = NS_TEMPLATE;
$part1 = $this->maybeDoSubpageLink( $part1, $subpage='' );
if ( !$found ) {
$ns = NS_TEMPLATE;
$part1 = $this->maybeDoSubpageLink( $part1, $subpage='' );
@@
-2081,9
+2086,9
@@
class Parser
$text = "\n" . $text;
}
}
$text = "\n" . $text;
}
}
-
- # Empties the template path
- $this->mTemplatePath = array();
+ # Prune lower levels off the recursion check path
+ $this->mTemplatePath = $lastPathLevel;
+
if ( !$found ) {
wfProfileOut( $fname );
return $matches[0];
if ( !$found ) {
wfProfileOut( $fname );
return $matches[0];
@@
-2115,9
+2120,8
@@
class Parser
}
}
}
}
}
}
-
- # Empties the template path
- $this->mTemplatePath = array();
+ # Prune lower levels off the recursion check path
+ $this->mTemplatePath = $lastPathLevel;
if ( !$found ) {
wfProfileOut( $fname );
if ( !$found ) {
wfProfileOut( $fname );