Indirectory List Block Missing Images Cause Exceptions

Permalink Browser Info Environment
In all the templates used in the indirectory_list, there is code like this:

$imageF = $cobj->getAttribute('logo');
if (isset($imageF)) {
     $image = $imgHelper->getThumbnail($imageF, 200, 120)->src;
}


This simply doesn't work - if the image is missing, or the attribute is unset, an exception is raised. This is because isset() is testing whether $imageF is a defined variable which it is - you've just defined it. The fact that it's not a File object is much more useful - you should replace all instances of isset() with is_object() in all the templates. Doing that stops all the templates throwing exceptions f the image is missing.

Type: Ticket
Status: Resolved
jero
View Replies:

concrete5 Environment Information

N/A

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.