I'm getting a Notice and a Warning here, not an error. My code still works. Just wanted to see if someone could figure out why I'm getting the notice and warning.
Notice: Trying to get property of non-object in file.php on line 152
Warning: in_array() expects parameter 2 to be array, null given file.php on line 152
Line 152 is an if() statement:
if($user->type == 'x' && in_array($user->email, $campaign->settings->email_list))
{ do stuff }
I've pinpointed the issue to the $campaign
object. Using print_r on $campaign outputs quite a bit of info, but this is the important part:
Campaign Object
{
[settings] => stdClass Object
(
[email_list] => Array
(
[0] => support@domain.com
[1] => customer@domain.com
)
)
}
Obviously, $campaign->settings->email_list is an array. Why am I getting the Notice and Warning, then? $campaign
is created directly above Line 152.