You are here: Foswiki>Tasks Web>Item12815 (12 Dec 2017, GeorgeClark)Edit Attach

Item12815: Backend Perl error from Edittable and more!

Priority: Normal
Current State: Needs Developer
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: EditTablePlugin
Reported By: VickiBrown
Waiting For:
Last Change By: GeorgeClark
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/ 

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.
%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.)
%TABLE{ tablewidth="80%" sort="on" tableborder="2" headerrows="1" footerrows="1"}%

That extra EDITTABLE call causes EditTablePlugin's 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

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

ItemTemplate edit

Summary Backend Perl error from Edittable and more!
ReportedBy VickiBrown
Codebase 1.1.9
SVN Range
AppliesTo Extension
Component EditTablePlugin
Priority Normal
CurrentState Needs Developer
TargetRelease n/a
ReleasedIn n/a
Topic revision: r3 - 12 Dec 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy