r3 - 27 Apr 2003 - 04:38:36 - PeterThoenyYou are here: TWiki >  Codev Web > AlternateWebPrefsBug
Tags:
, create new tag

Bug: Incorrect init of alternate web preferences

I think there is a bug in lib/TWiki/Prefs.pm. Under some circumstances, final preferences in alternate webs aren't returned correctly. The problem is, security preferences are final, so sometimes you can access topics and webs you wouldn't otherwise. I discovered the bug while developing PhotonSkin (PhotonSearch specifically, see PhotonSkinDev for details), so perhaps it's just me... but I've looked at the code and I think the bug is in TWiki.

I've patched my Prefs.pm and now it works fine.

--- Prefs.pm-old        Tue Apr  8 11:50:58 2003
+++ Prefs.pm    Tue Apr  8 11:09:34 2003
@@ -199,6 +199,8 @@
             @finalPrefsKeys = ();
             my @saveKeys    = @prefsKeys; # quick hack, this stinks
             my @saveValues  = @prefsValues; # ditto
+            @prefsKeys = ();
+            @prefsValues = ();
             getPrefsFromTopic( $TWiki::twikiWebname, $TWiki::wikiPrefsTopicname );
             getPrefsFromTopic( $altWebName, $TWiki::webPrefsTopicname );
             @altPrefsKeys   = @prefsKeys; # quick hack, this stinks

Test case

Environment

TWiki version: 20011221 (also in 20030201, AFAIK)
TWiki plugins:  
Server OS: Linux 2.4.7-10custom (RH 7.2)
Web server: Apache 1.3.27
Perl version: 5.6.1
Client OS: Linux
Web Browser: Opera 6.1, Mozilla 1.3

-- EstebanManchado - 09 Apr 2003

Follow up

This is indeed a bug. Moved over from Support.PossiblePrefsBug

-- PeterThoeny - 12 Apr 2003

Fix record

In TWikiAlphaRelease:

*** ../../TWiki/Prefs.pm        Sat Jan  4 17:36:32 2003
--- TWiki/Prefs.pm      Sat Apr 12 10:11:45 2003
***************
*** 200,205 ****
--- 248,255 ----
              @finalPrefsKeys = ();
              my @saveKeys    = @prefsKeys; # quick hack, this stinks
              my @saveValues  = @prefsValues; # ditto
+             @prefsKeys      = ();
+             @prefsValues    = ();
              getPrefsFromTopic( $TWiki::twikiWebname, $TWiki::wikiPrefsTopicname );
              getPrefsFromTopic( $altWebName, $TWiki::webPrefsTopicname );
              @altPrefsKeys   = @prefsKeys; # quick hack, this stinks

-- PeterThoeny - 27 Apr 2003

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
Codev.AlternateWebPrefsBug moved from Support.PossiblePrefsBug on 12 Apr 2003 - 05:39 by PeterThoeny - put it back
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo