After updating my shop to Magento 2.4 from 2.3 I am getting this error:

Warning: foreach() argument must be of type array|object, string given in /vendor/magento/module-catalog/view/frontend/templates/product/image_with_borders.phtml on line 17

I checked the code in image_with_borders.phtml on line 17 and it says:

foreach ($block->getCustomAttributes() as $name => $value):

I dumped the value of $block->getCustomAttributes() and its an empty string. This happens on the category page and on the homepage.


  • What is your php version ?
    – Taschert
    Aug 25, 2023 at 15:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.