Bugzilla – Bug 1890
Array preference is not created if it doesn't exist
Last modified: 2008-09-15 14:36:01 UTC
I have a problem setting an array value in a plugin: ShoutCast's sorting criteria is never stored and used. Streams therefore aren't sorted at all. Though the setting shows up on the plugins page, onChange is never called. I tried to reproduce it using other parameters and other plugins, but no luck. I think it's rather a problem with the new preferences stuff than with the plugin itself (of course!).
Created attachment 685 [details] create new array value if it doesn't exist yet The problem seems to be the new set() code: if there's no previous array value stored in $prefs{$key} nothing is done. The code checks whether it's an array or hash, but doesn't do anything if neither of them, thus not creating new array values in the preferences hash. This patch might help.
Change the summary - the old was misleading
Close, but it fails in the case where a new hash preference is being set. I'd also add an $ind !~ /\D/ check before assuming an array pref with the final else being a hash pref.
Should be fixed with change 3845.