Invalid argument supplied for foreach()

Thanks for all the great work you've done with this project. It's great!

I was just wondering about an error I've got a few hundred times in my Errors Log:

Invalid argument supplied for foreach()
/home/userdude/public_html/pics/main.php (Line:3221)

Is there anything I can do to stop this?

Thanks,
Willie Wonka

source

I checked the code around this. It looks fine. Not sure what is causing all the errors...


//take all groups where the user is a member
//and merge the grants to be easy to check it later if needed
$where="";
foreach($pa_user["groups"] as $key => $value){
if($where ==""){
$where = $where . "name=='".$key."'";
}else{
$where = $where . "|| name=='".$key."'";
}
}
$rec=db_select_all("group",$where);
$pa_grants=Array();
[ line 3221 ] foreach($rec as $record){
$pa_grants =array_merge($pa_grants,$record["grants"]);
}

I'm getting the

I'm getting the same:

Invalid argument supplied for foreach()
\htdocs\pix3\main.php (Line:3221)

Also getting these 2:

unlink(data_pix/.album_sys.php.lock) [function.unlink]: Permission denied
\htdocs\pix3\phpdatabase.php (Line:258)

unlink(data_pix/.album_languages.php.lock) [function.unlink]: No such file or directory
\htdocs\pix3\phpdatabase.php (Line:258)

Error log warning messages

My log file is full of messages like this:
"Invalid argument supplied for foreach()
/home/mhd-01/www.radiocorneliani.it/htdocs/phpAlbum/main.php (Line:3225)"
Is there some way to get these messagges not be written?
Thanks,
Daniele

No there is no way to switch

No there is no way to switch it off. Error log will be automaticalle deleted if it is bigger then 2MB. And it takes almost no performance as it is just appending some info on the end of a file.

But you are right, you do not need it if everything is ok, but it is better for me if you ask for support and something is wrong ... May be in the next version i will add "disable" checkbox for error logs.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8698264690166658"
data-ad-slot="4417389723">