Warning: reset() [function.reset]: Passed variable

apps

#1

I need help i dont know if its php or mysql problem but it really pisses me off before i move my site to dreamhost the script is working properly but after i moved it i have had 10 problems and i have fixed the 8 others but this 2 errors, i dont know cant find any solution.

this is the error:
Warning: reset() [function.reset]: Passed variable is not an array or object in /home/iagent/iagentz.com/inc/config.inc.php on line 362

and this is the code on line 362
$gpc = ini_get (‘magic_quotes_gpc’);
reset($frm_cookie);
while (list ($kk, $vv) = each($frm_cookie))
{
if (is_array ($vv))
{
}
else
{
if ($gpc == ‘1’)
{
$vv = str_replace (’\’’, ‘’’, $vv);
$vv = str_replace (’\"’, ‘"’, $vv);
$vv = str_replace (’\\’, ‘\’, $vv);
}

$vv = trim ($vv);
$vv = strip_tags ($vv);
}

$frm_cookie[$kk] = $vv;
}

:frowning: sad to say but i dont understand it.


#2

Your $frm_cookie is not an array, when you get this message. The easy thing will be to first test with is_array (as is done later in your script).


#3

oh my, thanks for the reply can you give me a hint how to test it using is_array? just a little hint honestly im still new with php.


#4

I don’t know exactly what your script does, and why $frm_cookie is or is not an array. But this should fix the errormessage, I guess:

$gpc = ini_get (‘magic_quotes_gpc’);
if (!is_array($frm_cookie)) {
reset($frm_cookie);
while (list ($kk, $vv) = each($frm_cookie)) {
if (is_array ($vv)) {
} else {
if ($gpc == ‘1’) {
$vv = str_replace (’\’’, ‘’’, $vv);
$vv = str_replace (’\"’, ‘"’, $vv);
$vv = str_replace (’\\’, ‘\’, $vv);
}

$vv = trim ($vv);
$vv = strip_tags ($vv);
}

$frm_cookie[$kk] = $vv;
}
}


#5

thanks for the responce @erikjacobsen but unfortunately that didnt help, i still havent resolved my issue. So what i did just to make sure if it was the script or dreamhost so what i did is that i transfered my files to my other host, i uploaded the source and import the sql i only touched the settings for the db and thats it, its all working fine. So i am guessing that its probably dreamhost problem. Guys this is the reason why i tried dreamhost but seems like its not as perfect as i thought. And the panel is so hard for me, anyone here knows how to contact Dh and ask for help? really im serious pls. i need help.