Closed (fixed)
Project:
htmLawed
Version:
6.x-3.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
8 Sep 2011 at 17:27 UTC
Updated:
2 Nov 2013 at 01:14 UTC
Jump to comment: Most recent
If you go to admin/settings/filters/[number]/configure and save settings, drupal_set_variable() is called with the keys "config", "spec", and "help". That's because the config form is a system_settings_form, which automatically gets variables created using the array index.
The solution would be to alter the form array to use indices like "htmLawed_format_[number]_config" and "htmLawed_format_[number]_spec". Then, read these variables separately with variable_get() elsewhere in the code. This would also eliminate the need for _htmLawed_store_setting().
Comments
Comment #1
alpha2zee commentedThank you for pointing this out. I will look into it (I never noticed the phantom variables), but my concern is about when the module is already in use. That is, I have to put in code to migrate variable values from the old (current) variables to new ones and then delete the old ones.
Comment #2
alpha2zee commentedHi Gribnif, can you tell me which database table gets the phantom variables and what are they named like? I am having trouble spotting anything unusual. Thanks.
Comment #3
andyf commentedJust noticed this with 6.x as well.
@alpha2zee check out the variable table. The form currently saves the data once using
_htmLawed_store_setting()and thensystem_settings_form_submit()also saves the variables based on the FAPI element name.If you were to go Gribnif's route you could use a hook_update_N() to migrate the old variable to the new ones.
HTH
Andy
Comment #4
alpha2zee commentedThanks, AndyF. I will fix the codes in a week or so once I have the time.
Comment #5
alpha2zee commentedI have released version 3.1 and 2.11 of the module for Drupal 6 to fix this issue by unsetting the unnecessary form values in _htmLawed_store_setting() to prevent the creation of the phantom variables 'cache', 'config', 'help', and 'spec'. I did not implement a functionality to remove such (harmless) phantom variables if they already exist in the 'variable' table of the Drupal database because of the possibility that some other module may be using variables with identical names.
Comment #6
alpha2zee commentedComment #7
alpha2zee commentedComment #8
alpha2zee commented