• 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.

Item5219: unqualified use of $TWiki::TranslationToken can lead to unexpected results

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal 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 just spent too many hours chasing down a bug in 4.1.2 caused by takeOutProtected's use of Translation token getting corrupted by emitTR's use of it.

4.2 has added a tag id to ttakeOutBlocks and takeOutProtected, but not to the collspan code in emitTR - so its still possible to have the problem - but much less likely (ie if a plugin gets into the rendering loop, or if you manage to make a topic with the translationToken.

So I'm going to add a qualifier..

 Index: twikiplugins/TablePlugin/lib/TWiki/Plugins/TablePlugin/Core.pm
===================================================================
--- twikiplugins/TablePlugin/lib/TWiki/Plugins/TablePlugin/Core.pm      (revision 16166)
+++ twikiplugins/TablePlugin/lib/TWiki/Plugins/TablePlugin/Core.pm      (working copy)
@@ -574,7 +574,7 @@
 
     $theRow =~ s/\t/   /go;    # change tabs to space
     $theRow =~ s/\s*$//o;      # remove trailing spaces
-    $theRow =~ s/(\|\|+)/$translationToken.length($1)."\|"/geo;   # calc COLSPAN
+    $theRow =~ s/(\|\|+)/'colspan'.$translationToken.length($1)."\|"/geo;   # calc COLSPAN
     my $colCount = 0;
     my @row      = ();
     $span = 0;
@@ -585,7 +585,7 @@
         $span = 1;
 
         #AS 25-5-01 Fix to avoid matching also single columns
-        if (s/$translationToken([0-9]+)//) {
+        if (s/colspan$translationToken([0-9]+)//) {
             $span = $1;
             $attr->{colspan} = $span;
         }
Index: lib/TWiki/Render.pm
===================================================================
--- lib/TWiki/Render.pm (revision 16166)
+++ lib/TWiki/Render.pm (working copy)
@@ -302,7 +302,7 @@
 
     $theRow =~ s/\t/   /g;  # change tabs to space
     $theRow =~ s/\s*$//;    # remove trailing spaces
-    $theRow =~ s/(\|\|+)/$TWiki::TranslationToken.length($1).'|'/ge;  # calc COLSPAN
+    $theRow =~ s/(\|\|+)/'colspan'.$TWiki::TranslationToken.length($1).'|'/ge;  # calc COLSPAN
     my $cells = '';
     my $containsTableHeader;
     my $isAllTH = 1;
@@ -310,7 +310,7 @@
         my @attr;
 
         # Avoid matching single columns
-        if ( s/$TWiki::TranslationToken([0-9]+)//o ) {
+        if ( s/colspan$TWiki::TranslationToken([0-9]+)//o ) {
             push( @attr, colspan => $1 );
         }
         s/^\s+$/   /;

-- TWiki:Main/SvenDowideit - 08 Jan 2008

ItemTemplate
Summary unqualified use of $TWiki::TranslationToken can lead to unexpected results
ReportedBy TWiki:Main.SvenDowideit
Codebase 4.2.0, ~twiki4
SVN Range TWiki-4.3.0, Sun, 30 Dec 2007, build 16120
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:16167 TWikirev:16168
TargetRelease minor
ReleasedIn 4.2.0
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2008-01-22 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback