Closed (fixed)
Project:
Skinr
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2010 at 16:58 UTC
Updated:
24 Nov 2010 at 19:10 UTC
Jump to comment: Most recent file
The skinr_submit_handler() function in includes/handlers.inc has a logic error:
if ((isset($theme['widgets']) && count($theme['widgets'])) || isset($theme['advanced']['_additional'])) {
...
if (is_array($theme['widgets'])) {
Note that it continues working with $theme['widgets'] even if it doesn't exist.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | submithandlers-906764-HEAD.patch | 3.83 KB | vrajak@gmail.com |
| #13 | submithandlers-906764-D61x.patch | 2.67 KB | vrajak@gmail.com |
| #9 | submithandlers-906764-1x.patch | 2.79 KB | vrajak@gmail.com |
| #8 | submithandlers-906764-8.patch | 3.87 KB | vrajak@gmail.com |
| #5 | 906764-2.x.patch | 1.39 KB | jacine |
Comments
Comment #1
damienmckennaHere's a quick patch to improve the logic in skinr_submit_handler().
Patch sponsored by Bluespark Labs.
Comment #2
ericduran commented@DemienMcKenna, I don't see the logic error. It seems like you're doing the same exact thing but in a different style.
I might be wrong since it's pretty late :-/ and my eyes are tired lol, but maybe some comments? or a little more explanation.
Comment #3
jacineI'd like to either fix this or close it, but I don't know if there is a logic error or not.
Comment #4
damienmckennaThere were two modifications made:
1:
changes to:
This change had a flaw where the $theme['widgets'] variable could be something other than array. According to the PHP manual this is syntactically valid but is logistically unclear and allows for $theme['widgets'] to be something other than an array (which is the desired data structure).
2:
changed to:
If $theme['widgets'] does not exist the is_array() call will give an E_NOTICE. The first if statement (#1 above) allows for this block to be executed when $theme['widgets'] does not exist, so it is necessary to check if it exists first before working with it.
Comment #5
jacine@Damien that you so much for explaining that. I committed your patch, and it will be in the next release: http://drupal.org/cvs?commit=439792 :)
This is also a problem in the 2.x branches. Here's a patch for that.
Comment #6
vrajak@gmail.com commentedI applied the patch locally, patches fine and the new code shows up in the skinr.handlers.inc file. I don't know if I need to test anything else with it.
*edit* will do some more testing as discussed in IRC :)
Comment #7
jacineActually, this needs work.
That logic exists in other submit hander functions, like for panels, etc. This needs to be applied to those as well.
Comment #8
vrajak@gmail.com commentedI'm attaching a patch, which incorporates DamienMcKenna's changes in comment #4 to the panels.skinr.inc and views.skinr.inc files. Actually it also includes the changes from Jacine's patch above. I've tested it locally with and without skins and am no longer receiving the widget related errors when editing a skinr settings form. Would be great if someone else could review it as well just to make sure its working.
*edit* is for the D6 2x branch
Comment #9
vrajak@gmail.com commentedHere's the same patch for the D6 1x Branch. Works for me but needs review.
Comment #11
vrajak@gmail.com commented#9: submithandlers-906764-1x.patch queued for re-testing.
Comment #13
vrajak@gmail.com commentedHere's another try at the D6 1x branch patch. It works for me (actually the last patch failed when I tested it, doh. This one I made sure its working.) If someone else could give it a try that would be great. It just changes the two lines of code in panels.skinr.inc and views.skinr.inc, handlers.inc already had the right code so I didn't have to change it.
Comment #14
vrajak@gmail.com commentedTrying out a patch for the 7x HEAD version, same code changes as above.
Comment #16
moonray commentedLet's make this patch apply to 6.x-1.x (and ignore all others for now), since that version needs a new release ASAP.
Comment #17
moonray commented#13: submithandlers-906764-D61x.patch queued for re-testing.
Comment #18
vrajak@gmail.com commentedComment #19
vrajak@gmail.com commented#14: submithandlers-906764-HEAD.patch queued for re-testing.
Comment #20
vrajak@gmail.com commentedComment #21
jacineCommitted! Thanks all ;)
6.x-1.x: http://drupal.org/cvs?commit=448998
6.x-2.x: http://drupal.org/cvs?commit=448992
HEAD: http://drupal.org/cvs?commit=449000