I don't want to get into the details, suffice to say I had need to write a SimpleDesk plugin today, and one of the things it does is add a new area to the admin panel, through $config_vars being passed to prepareDBSettingsContext. Nothing wrong there.
Then, after I finish setting up the array and passing it through to that function, I get a Warning: Invalid argument supplied for foreach() in C:\Dev\public_html\intranet\smf_2-0_install\Sources\ManageServer.php on line 1824.
This is a bit strange, but sure enough, line 1824:
Code: [Select]
Now, there's nothing happening between the start of prepareDBSettingsContext and that line that touches $config_var. And if I do a var_dump, I find there's a random NULL at the end of the var-dump that appears to be breaking it. Now, I'm confused because I have no idea where that NULL is coming from.
Here's the kicker: if I var_dump BEFORE the call, I get a normal var_dump and the array is normally traversable, so something about the call itself causes it to go nuts. It's not even the fact it's a reference, I reverted it to a normal variable by value and the same thing happens.
It's not like there's anything else going on - this variable is passed directly to the destination function and nothing hokey is going on in the middle.
So I'm really, really confused, and wondering if it's a bug. Maybe I should try upgrading (currently on 5.2.13 on local PC)
In other news, I am actually going mad, ignore me. Stupid bug, having spent an hour of frustrated debugging, because I forgot something quite important...
Then, after I finish setting up the array and passing it through to that function, I get a Warning: Invalid argument supplied for foreach() in C:\Dev\public_html\intranet\smf_2-0_install\Sources\ManageServer.php on line 1824.
This is a bit strange, but sure enough, line 1824:
foreach ($config_vars as $config_var)
Now, there's nothing happening between the start of prepareDBSettingsContext and that line that touches $config_var. And if I do a var_dump, I find there's a random NULL at the end of the var-dump that appears to be breaking it. Now, I'm confused because I have no idea where that NULL is coming from.
Here's the kicker: if I var_dump BEFORE the call, I get a normal var_dump and the array is normally traversable, so something about the call itself causes it to go nuts. It's not even the fact it's a reference, I reverted it to a normal variable by value and the same thing happens.
It's not like there's anything else going on - this variable is passed directly to the destination function and nothing hokey is going on in the middle.
So I'm really, really confused, and wondering if it's a bug. Maybe I should try upgrading (currently on 5.2.13 on local PC)
Posted: July 8th, 2011, 12:46 AM
In other news, I am actually going mad, ignore me. Stupid bug, having spent an hour of frustrated debugging, because I forgot something quite important...