Item8228: SETVAR macro will be applied unexpectedly to other topics
Priority: Normal
Current State: Closed
Released In:
Target Release:
After using the SETVAR and UNSETVAR macros the preferences will be applied unexpectedly to other topics too. The problem occurs on my foswiki 1.0.6 installation with PatternSkin and can be reproduced with the following steps:
- Insert a SETVAR or UNSETVAR macro on a topic. The settings will then be applied as expected.
- Now edit an other topic without using SETVAR or UNSETVAR macros on it. Then the settings from the last topic (from last SETVAR call) will be added to this topic.
I played a little bit around with the DEBUGRULES macro and find out, that SETVAR rules seems to be stored. On each edit/save cycle on a topic with a SETVAR macro a new line gets appended to the DEBUGRULES table (please see the attached screenshot). If you edit another topic without an SETVAR statement but insert the DEBUGRULES macro, then the same rules as on the previous topic are shown. My example SETVAR call for this was:
%SETVAR{"ALLOWTOPICVIEW" type="Set" value="SomeGroup"}%
I have edited the Core.pm file and added @{$this->{rules}} = (); to the end of the handleBeforeSave function to delete all rules after saving the topic. After this the DEBUGRULES table looks at expected for me, but the last rules will still be appended to the next edited topic.
I have added some description of my desired use case for the
SetVariablePlugin to
SetVariablePlugin
--
SebastianPinnau - 05 Aug 2009
After further testing it seems the problem is related to
FastCGIEngineContrib. I'm using this extension on apache2 with mod_fcgid. If i turn off mod_fcgid in my apache config then all works fine.
--
SebastianPinnau - 05 Aug 2009
The proper fix is to undef the $core in initPlugin
--
MichaelDaum - 17 Nov 2009