Update #6003 is broken if the variable is an empty string
deviantintegral - August 6, 2009 - 23:50
| Project: | Masquerade |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If "masquerade_quick_switches" is an empty string, then the update code doesn't change the variable from a string to an array. This throws a warning when the variable is used to display the block.
This patch changes the function to delete the variable entirely if it's empty.
| Attachment | Size |
|---|---|
| empty_quick_switch.patch | 599 bytes |

#1
#2
This patch only a part of problem so need more work to adequately check variables for loops
#3
I'm not sure what you mean by loops?
#4
I mean that using
foreach (variable_get(..is wrong - this should be fixed first#5
The variable_get() call will either return an array of values, or an empty array. If it's not returning an array (due to broken code, or some other module saving a string or an int) then that code should be fixed. For an example in core, see color.module.
I've committed this, but feel free to follow up with another patch if you run into any issues.
#6
Hi, the latest update in 1.x-dev is not fixing this problem.
I do not see the warning until I save the settings page. I tried to fix it, but I couldn't get to the bottom of it. The loop is not getting the array that it expects. I put a print statement on the variable that it was looping on and saw the serialized data in the plain text string. The error warning occurs without entering any information at all on the settings page, but upon further investigation I can see that the serialized data that I entered into the Block input is stored in the DB but it does not appear in the input on the Masquerade settings page.
This problem also affected version 1.1 as well. Is the Block displaying properly for everyone else? This sounds like the same problem describe in this issue, but I don't know for sure.
#7
Gosh, I guess I should set this back. I'm pretty sure there should be a drupal_explode_tags($masquerade_switches); somewhere around line 382 and I'm not sure what else.
#8
It appears there is no data in my 'masquerade' and 'masquerade_users' tables. What would cause this? The $masquerade_switches array is empty. I believe that's the cause of the the second warning I'm getting.
#9
Can you post the output of all of the masquerade_% values from the variables table?
#10
I looked into this, and the issue is actually different then the one here. Lets continue the discussion over at #565860: Block quick switch users not properly saved.
#11
Automatically closed -- issue fixed for 2 weeks with no activity.