Closed (fixed)
Project:
Flag
Version:
7.x-2.x-dev
Component:
Flag core
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Apr 2011 at 07:47 UTC
Updated:
3 Jan 2014 at 02:58 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
corbacho commentedI was searching for other stuff... but I found this nice patch, it deserves a little attention... bumping
Comment #2
jaydub commentedThe patch doesn't apply likely due to the extra text in the header. Here is a re-rolled patch to apply cleanly to current d7.
I didn't apply the drupal_static to the static variables defined inside the flag class as I'm unsure that the behavior would work correctly in a class method vs a function.
Whether or not it's important to convert the static to drupal_static remains to be seen as per this mention on the drupal_static api page:
"A guideline is that if a function's static variable does not depend on any information outside of the function that might change during a single page request, then it's ok to use the "static" keyword instead of the drupal_static() function."
If however converting to drupal_static helps with testing as the original poster suggests then this patch can help in that regard.
Comment #3
quicksketchThis patch is a good idea. I think we would accidentally be modifying the return structure in some situations though. For example this change:
The drupal_static() approach doesn't initialize the value to array() for us, so $default_flag would be NULL instead of an array. Looks like it just needs to be fixed to:
Comment #4
quicksketchComment #5
joachim commentedComment #6
joachim commentedRerolled and made the changes from #3.
Note that one of the changes to drupal_static() has already been handled by #1395034: Stale data as static cache isn't cleared on flag.
Testbot!
Comment #7
joachim commentedTests pass. Committed.
Issue #1113904 by katbailey, jaydub, joachim: Changed use of static to drupal_static().
Comment #8
joachim commentedShould be backported to 7.x-2.x. The patch in #2 would be the one to start from, with corrections from #3.
Comment #9
socketwench commentedHere you go!
Comment #10
socketwench commentedComment #11
joachim commentedTests pass and looks good to me.
Comment #12
socketwench commentedAnd committed.