OpenEuphoria.org
Ticket #287:
The WIKIPAGE plugin goes into an endless loop
-
Reported by
DerekParnell
Oct 31, 2010
I need a lot more detail about this issue, including a sample piece of creole text that demonstrates the problem.
Details
1. Comment by jeremy
Oct 31, 2010
You can see the bug in the euweb project, see format.e See line 173.
case Plugin then
lInstance = pParms[4]
lParms = keyvalues(pParms[1], -1, -2)
lHTMLText = ""
switch upper(lParms[1][2]) do
case "WIKIPAGE" then
--lHTMLText = creole_plugin_wikipage(lParms)
end switch
The creole_plugin_wikipage function is at line 59:
function creole_plugin_wikipage(sequence params)
sequence result = ""
sequence style = "none"
sequence page = "--INVALID-PAGE--"
integer toc_heading = 1
log:log("creole plugin running")
for i = 2 to length(params) do
switch params[i][1] do
case "style" then
style = params[i][2]
case "page" then
page = params[i][2]
case "heading" then
if find(params[i][2], { "on", "off", "hide", "0" }) then
toc_heading = 0
end if
end switch
end for
if toc_heading then
result &= sprintf("<a href=\"/wiki/view/%s.wc\">%s</a>:\n", {
page, page })
end if
result &= sprintf("<div class=\"wiki %s\">", { style })
object wikipage = wiki_db:get(page)
if atom(wikipage) then
return "<strong>INVALID PAGE</strong>"
end if
result &= format_body(wikipage[wiki_db:WIKI_TEXT])
result &= "</div>"
return result
end function
When the wiki page contains any reference to this plugin the creole_plugin_wikipage is executed endlessly. In the log I get "creole plugin running" forever, well, until I kill the process.
2. Comment by jeremy
Oct 31, 2010
After further testing, this exhibits the same endless loop problem:
case Plugin then
lInstance = pParms[4]
lParms = keyvalues(pParms[1], -1, -2)
lHTMLText = ""
switch upper(lParms[1][2]) do
case "TEST" then
lHTMLText = test_plugin(lParms)
end switch
test_plugin being:
function test_plugin(sequence parms)
log:log("test plugin running")
return "test plugin"
end function