Item13672: EditRowPlugin not working on mod_perl systems.

Priority: Urgent
Current State: Closed
Released In: 2.0.2
Target Release: patch
Applies To: Extension
Component: EditRowPlugin
Branches: master
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
I've recreated the issue reported in Support.Question1656. Everything appears functional but save doesn't save anything. original data remains after clicking the save button.

Crawford, I'm marking this waiting for you. I'll continue to poke through the code to see if I can spot where the problem occurs.

I can't recreate the issue on fcgi, but that's not surprising as the requests rotate between multiple fcgi handlers.

-- GeorgeClark - 04 Sep 2015

This might be a deeper issue in our mod_perl support. With Save TRACE=1 set, it appears as though some parameters are being duplicated. First the POST - whitespace added:
And the debug log:
| 2015-09-03T23:17:09-04:00 debug | $saveRowCmd = {
                'erp_table' => 'EDITTABL_0,EDITTABL_0',
                'erp_row' => '2',
                'erp_cell_EDITTABL_0_2_0' => 'Cadrw asdf',
                'erp_topic' => 'Sandbox.TestEditTable,Sandbox.TestEditTable',
                'validation_key' => '3b502c986614d991560603b43c793178',
                'erp_cell_EDITTABL_0_2_1' => 'No',
                'erp_action' => ',saveRowCmd',
                'erp_version' => '2_1441335964,2_1441335964',
                'erp_EDITTABL_0_format' => '&vbar;-20text,20&vbar;-20text,20&vbar;'
erp_action appears to be legitimately duplicated in the query params, so that might point to a js error. But all of the rest only occur once. multi_param returns duplicates on erp_table, erp_topic erp_version. The rest of the parameters are not duplicated.

-- GeorgeClark - 04 Sep 2015

The parameter dump above suggests you may have an outmoded ERP.

-- CrawfordCurrie - 04 Sep 2015

I updated to the latest ERP on my 2.0.1 mod_perl server, and it won't work at all. It appears that core changes are needed for the latest ERP. I'll have to build a candidate 2.0.2 to test this further. Which leaves us with a question on how to prevent upgrades of ERP on existing 2.0.0 / 2.0.1 systems if they are incompatible.

-- GeorgeClark - 04 Sep 2015

I've built a 2.0.2-Alpha with all the latest fixes. Still seeing duplicated parameters, specific to mod_perl.
| 2015-09-04T22:09:19-04:00 debug | ERP: SAVE saveRowCmd, Sandbox.TestEditTable for AdminUser |
| 2015-09-04T22:09:19-04:00 debug | $saveRowCmd = {
                'erp_row' => '2',
                'erp_table' => 'TABLE_0,TABLE_0',
                'validation_key' => 'f4fc61ffff35cc0f8dcce48ccc65847a',
                'erp_topic' => 'Sandbox.TestEditTable,Sandbox.TestEditTable',
                'erp_action' => ',saveRowCmd',
                'erp_version' => '3_1441418882,3_1441418882',
                'erp_cell_TABLE_0_2_1' => 'No',
                'erp_TABLE_0_format' => '&vbar;-20text,20&vbar;-20text,20&vbar;',
                'erp_cell_TABLE_0_2_0' => 'Cadrw asdf foo'

-- GeorgeClark - 05 Sep 2015

The bug here is because mod_perl merges the query parameters with the posted form data. This is a side effect of Item11707. The URI contains:;erp_version=4_1441421771;erp_table=TABLE_0
This DUPLICATES the form data, and is merged by mod_perl, but not merged when using CGI. POST of a form should not also duplicate the parameters in the URI.

-- GeorgeClark - 05 Sep 2015

Here is a fix for mod_perl, complete with unit test changes. No idea if this will cause issues in a non-javascript environment.
diff --git a/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/ b/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/
index 4afff08..8effb82 100644
--- a/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/
+++ b/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/
@@ -115,8 +115,7 @@ sub process {
             my $active_row = $urps->{erp_row};
             my $saveUrl =
-              Foswiki::Func::getScriptUrl( 'EditRowPlugin', 'save', 'rest',
-                $_->getParams('erp_') );
+              Foswiki::Func::getScriptUrl( 'EditRowPlugin', 'save', 'rest' );
             $line .= "<form action='$saveUrl' method='POST' name='erp_form_"
               . $table->getID() . "'>";
diff --git a/EditRowPlugin/test/unit/EditRowPlugin/ b/EditRowPlugin/test/unit/EditRowPlugin/
index fe0adc6..6ec5cc7 100644
--- a/EditRowPlugin/test/unit/EditRowPlugin/
+++ b/EditRowPlugin/test/unit/EditRowPlugin/
@@ -296,9 +296,10 @@ INPUT
     my $saveurl = Foswiki::Func::getScriptUrl(
         "EditRowPlugin", "save", "rest",
-        erp_version => "VERSION",
-        erp_topic   => "$this->{test_web}.$this->{test_topic}",
-        erp_table   => "TABLE_0"
+# SMELL: Item13672 - POST with querystring duplicates the Form input
+#        erp_version => "VERSION",
+#        erp_topic   => "$this->{test_web}.$this->{test_topic}",
+#        erp_table   => "TABLE_0"
     my $expected = <<EXPECTED;
 <form method="POST" action="$saveurl" name="erp_form_TABLE_0">
@@ -355,9 +356,10 @@ INPUT
     my $saveurl = Foswiki::Func::getScriptUrl(
         "EditRowPlugin", "save", "rest",
-        erp_version => "VERSION",
-        erp_topic   => "$this->{test_web}.$this->{test_topic}",
-        erp_table   => "TABLE_0"
+# SMELL: Item13672 - POST with querystring duplicates the Form input
+#       erp_version => "VERSION",
+#       erp_topic   => "$this->{test_web}.$this->{test_topic}",
+#       erp_table   => "TABLE_0"
     my $expected = <<EXPECTED;

-- GeorgeClark - 05 Sep 2015

I don't think there will be any problem in non-JS mode. i just tried to test it, though, and can't get non-JS mode to appear, so I'm inclined just to ignore it.

The most recent ERP works in non-JS mode by submitting the form, in which case the form should be providing all the necessary parameters and the querystring is just noise (at least as far as ERP parameters are concerned). In JS mode, the form is constructed by reading the HTML5 data attached to the table.

So go ahead with your patch.

-- Main.CrawfordCurrie - 07 Sep 2015 - 07:15

ItemTemplate edit

Summary EditRowPlugin not working on mod_perl systems.
ReportedBy GeorgeClark
Codebase 2.0.1
SVN Range
AppliesTo Extension
Component EditRowPlugin
Priority Urgent
CurrentState Closed
Checkins distro:fe563ecb6684
TargetRelease patch
ReleasedIn 2.0.2
CheckinsOnBranches master
masterCheckins distro:fe563ecb6684
Topic revision: r9 - 10 Oct 2015, 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