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 | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2003-04-27 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.