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