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