-
Notifications
You must be signed in to change notification settings - Fork 92
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
PHP Warning: Invalid argument supplied for foreach() in Image.php on line 155 #23
PHP Warning: Invalid argument supplied for foreach() in Image.php on line 155 #23
Conversation
…ge::checkNumberOfAllowedFilters() when glob() returns false - Moved Image::checkNumberOfAllowedFilters() and Image::checkReferrer() calls into Image::setupFile() function - Removed duplicate code in Image::checkCache()
Thanks for this, I'll have a look now. |
This also fixes 404s on uncached images, if you set the option "numberOfAllowedFilters" to 1 (in the case where glob() returns false, because count(false) == 1). |
Hi Alexander, I haven't had the time to completely look at your pull request do to work commitments. I hope to get it all merged in this weekend :). Just wondering though, the return from glob(), can you not just check to make sure it's an array with |
That's exactly what I am doing :) (lines 157-159)
The other parts is more or less just refactoring (removing duplicate code, move filter checks out of "checkCache()" method, don't call "checkNumberOfAllowedFilters()" if there are filter requested). I'll annotate them. |
Well I feel silly now haha. I only had a very brief look ><. Okay well, I'll merge this in on the weekend. Thanks again! |
Haha don't feel silly! Thanks for having a look. I hope the annotations help you see my intentions for the changes. |
I've just went through it and these are great changes! Can't believe I didn't use I'm just going to merge these now and create a new release. Thanks a ton! Your pull requests are welcome any time 👍. |
…mages Fixing a PHP Warning: Invalid argument supplied for foreach() due to glob() sometimes returning false rather than an array. Plus some refactoring changes to remove duplicate code.
1.5.15 is now released :) - http://mun.ee/Changelog Thanks again! |
Requesting an image, which has not been cached yet, leads to a PHP warning:
This is because glob() may return false instead of an empty array which is then passed to foreach (leading to a warning):
Here's my pull request which fixes this warning: