Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if no exceptions are specified, php spams warnings about 'Invalid argument supplied for foreach()' #28

Open
kn00tcn opened this issue Apr 2, 2019 · 0 comments

Comments

@kn00tcn
Copy link

kn00tcn commented Apr 2, 2019

are these two blocks causing php warnings?

foreach ($this->exceptions as $key => $value) {
    $this->exceptions[$key] = array_filter($value, function ($element) {
        return (trim($element) !== '');
    });
}
foreach ($this->exceptions as $ex_day => $ex_hours) {
    if (strtotime($ex_day) === $today) {
        // Today is an exception, use alternate hours instead
        $hours_today = $ex_hours;
    }
}

wrapping them with if ($this->exceptions) seems to stop the warnings, not sure if isset should be used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant