https://bugzilla.wikimedia.org/show_bug.cgi?id=18165
--- Comment #2 from Robert Rohde <[email protected]> 2009-03-26 03:13:24 UTC --- (In reply to comment #1) > The function cache is a static variable, and therefore not cleared. By declaring it static you create a globally accessible variable AbuseFilterParser::$funcCache, that has one value, but every instance of the class has it's own instantiation of $funcCache that is separate from the global variable and separate from each other. So strictly speaking you didn't clear it, rather by calling new you created a new one that is blank. Test this yourself. $funcCache is not retained across rules. > The variable holder is not being reset to its original state. It's an object, > so it's passed by reference, so you'd need specific code to reset it to its > original state. You have such code. More precisely, each time AbuseFilterParser is created it in turn creates a new AbuseFilterVariableHolder and then calls addHolder to copy the parameters passed to it in setVars. Those parameters consist of an array of AFPData and AFPComputedVariable objects. During the course of operation you replace the AFPComputedVariable objects which AFPData objects as you fetch the values. The problem here is that because you copied the array into a local holder, and didn't simply attach the original VariableHolder by reference, that means that the data array in the original VariableHolder is unaware of the actions occuring in the local copy. Specifically, it doesn't know that you replaced ComputedVariables with Data. So each time you create a new parser you end up passing it the original VariableHolder that still contains the unprocessed ComputedVariables. The end result is that both the $funcCache and the ComputedVariables are being lost upon the creation of a new AbuseFilterParser. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
