• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item4944: EditTablePlugin data corruption under mod_perl

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension EditTablePlugin Urgent Closed   minor 4.2.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

I'm using TWiki under mode_perl.

One of my users reported that tables on his pages are corrupted when updated by EditTablePlugin. I confirmed his claim by the page history. I looked into the code and realized that file global variables in TableEditPlugin/Core.pm are not initialized.

So I applied the following patch and since then the data corruption problem hasn't been observed.

--- lib/TWiki/Plugins/EditTablePlugin/Core.pm   2007-03-03 23:45:58.000000000 +0900
+++ lib/TWiki/Plugins/EditTablePlugin/Core.pm.patched  2007-11-09 19:01:39.000000000 +0900
@@ -28,7 +28,25 @@
             $nrCols $encodeStart $encodeEnd $table $query
            );
 
+# initialize to avoid weird problem
+sub init {
+    $preSp = undef;
+    %params = ();
+    @format = ();
+    @formatExpanded = ();
+    $prefsInitialized = undef;
+    $prefCHANGEROWS = undef;
+    $prefEDITBUTTON = undef;
+    $prefQUIETSAVE = undef;
+    $nrCols = undef;
+    $encodeStart = undef;
+    $encodeEnd = undef;
+    $table = undef;
+    $query = undef;
+}
+
 sub process {
+    init();
     $query = TWiki::Func::getCgiQuery();
     TWiki::Func::writeDebug( "- EditTablePlugin::commonTagsHandler( $_[2].$_[1] )" ) if $TWiki::Plugins::EditTablePlugin::debug;
     unless( $prefsInitialized ) {

-- TWiki:Main/HideyoImazu - 09 Nov 2007

Switching to urgent.

-- TWiki:Main.ArthurClemens - 19 Nov 2007

I have implemented this when I was working on Item3805. But a little bit different than the proposal above - I have put the initializing code inside BEGIN (to align with TablePlugin). Please review if this is sufficient.

-- TWiki:Main.ArthurClemens - 30 Nov 2007

I suspect initialization in a BEGIN block doesn't help solving the problem happening under mod_perl. SInce a BEGIN block is executed at compile time only. And the initialization is needed every time the plugin is executed.

-- TWiki:Main.HideyoImazu - 01 Dec 2007

Re-implemented as suggested.

-- TWiki:Main.ArthurClemens - 01 Dec 2007

ItemTemplate
Summary EditTablePlugin data corruption under mod_perl
ReportedBy TWiki:Main.HideyoImazu
Codebase 4.1.2
SVN Range TWiki-4.3.0, Fri, 12 Oct 2007, build 15261
AppliesTo Extension
Component EditTablePlugin
Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:15813 TWikirev:15814 TWikirev:15819 TWikirev:15820
TargetRelease minor
ReleasedIn 4.2.0
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r14 - 2008-01-22 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback