Title: PHP bug in CacheImage
Last modified: March 29, 2024

---

# PHP bug in CacheImage

 *  Resolved [ewd910](https://wordpress.org/support/users/ewd910/)
 * (@ewd910)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/php-bug-in-cacheimage/)
 * Hi, getting tons of PHP warnings in my server logs coming from this plugin. The
   warning is:
 *     ```wp-block-code
       PHP Warning: foreach() argument must be of type array|object, bool given in /var/app/current/wp-content/plugins/nextend-smart-slider3-pro/Nextend/Framework/Cache/CacheImage.php on line 118
       ```
   
 * The line in question is in this code block:
 *     ```wp-block-code
       if (!$h || strpos($h[0], '200') !== false) {
           foreach ($h as $k => $v) {
               if (strtolower(trim($k)) == "last-modified") {
                   return (new DateTime($v))->getTimestamp();
               }
           }
       }
       ```
   
 * So if `$h` is false, enter the foreach loop? Seems wrong to me, hope this can
   be fixed soon. Thanks

Viewing 1 replies (of 1 total)

 *  Plugin Support [Robert](https://wordpress.org/support/users/robertnextendweb/)
 * (@robertnextendweb)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/php-bug-in-cacheimage/#post-17545017)
 * Hi [@ewd910](https://wordpress.org/support/users/ewd910/)
 * Indeed that seems to be the case, so in this case please update this code part
 *     ```wp-block-code
       if (!$h || strpos($h[0], '200') !== false) {
       ```
   
 * to this
 *     ```wp-block-code
       if (is_array($h) && strpos($h[0], '200') !== false) {
       ```
   
 * And it should work as expected afterwards. We will also include this in the next
   Smart Slider update.

Viewing 1 replies (of 1 total)

The topic ‘PHP bug in CacheImage’ is closed to new replies.

 * ![](https://ps.w.org/smart-slider-3/assets/icon.svg?rev=2307688)
 * [Smart Slider 3](https://wordpress.org/plugins/smart-slider-3/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/smart-slider-3/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/smart-slider-3/)
 * [Active Topics](https://wordpress.org/support/plugin/smart-slider-3/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/smart-slider-3/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/smart-slider-3/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Robert](https://wordpress.org/support/users/robertnextendweb/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/php-bug-in-cacheimage/#post-17545017)
 * Status: resolved