Item12815: Backend Perl error from Edittable and more!
Priority: Normal
Current State: Needs Developer
Released In: n/a
Target Release: n/a
I'm getting a strange backend error from EditTable when I try to save.
Foswiki detected an internal error - please check your Foswiki logs and webserver logs for more information.
Can't call method "param" on an undefined value
The full error in the Apache log is
Can't call method "param" on an undefined value at /Volumes/Datastore/Local/WWW/web/cfcl/foswiki119/lib/Foswiki/Plugins/EditTablePlugin/Core.pm
I deleted the
lib/.../EditTablePlugin
directory and
lib/.../EditTablePlugin
and reinstalled and still see this error.
More testing... chatting on IRC.
Two things have come to light:
1. CDot (
CrawfordCurrie) suggests:
problem is due to using global variables. When the processText function is entered, it grabs the cgi query. It later calls a function that causes the plugin handlers to be recursively invoked, which calls the init function again - clearing the query.
to test my theory, please put this on line 285:
$query = Foswiki::Func::getCgiQuery();
This caused the error to stop (but some other weirdness happened. e.g. the raw wiki test now showed, e.g.
%EDITTABLE{}%%EDITTABLE{}%%EDITTABLE{}%%EDITTABLE{}%
%TABLE{ tablewidth="80%" sort="on" tableborder="2" headerrows="1" footerrows="1"}%
%TABLE{ tablewidth="80%" sort="on" tableborder="2" headerrows="1" footerrows="1"}%
It has also replicated the table code (rows) multiple times.
2. Further investigation shows that I had a bug in one of my initial tables. I had one extra
%EDITTABLE{}%
macro. So, in one table, I was calling
EDITTABLE
both above and below the
TABLE
macro. (Note: this wasn't even the table that I had tried to edit.)
%EDITTABLE{}%
%TABLE{ tablewidth="80%" sort="on" tableborder="2" headerrows="1" footerrows="1"}%
%EDITTABLE{}%
That extra
EDITTABLE
call causes
EditTablePlugin's Core.pm code to go wild, spitting out an error and rewriting the backend Wiki Markup with even more duplicates.
You can play at:
Sandbox/EditTablePluginTestVickiBrown
For anyone who asks: "why didn't I notice the table code was replicated earlier?" The topic I am working with has half a dozen tables on it and the markup error (extra
%EDITTABLE{}%
) was "below the fold"
--
VickiBrown - 22 Mar 2014
p.s. I really hate recursion...
FYI: Neither issue appears in TWiki6
http://twiki.org/cgi-bin/edit/Sandbox/EditTableTestVickiBrown
also, the spurious (extra)
%EDITTABLE{}%
macro is removed by TWiki 6's EditTable Plugin.
Suggestion: compare code.
--
VickiBrown - 22 Mar 2014
EditTablePlugin has been deprecated, replaced by
EditRowPlugin. Setting to Needs Developer.
--
GeorgeClark - 12 Dec 2017