so i've placed [-[!Gallery]-] in my resource (parameters doesnt matter)
this is supposed to show all albums (and it shows
) but if you have request var (default is galAlbum) and set it to id which doesnt exist
like /gallery?galAlbum=99 (assuming u doesnt have album with ID 99 ) page wont load and shows you fatal error:
Warning: Invalid argument supplied for foreach() in lalala/modx/core/cache/includes/elements/modsnippet/18.include.cache.php on line #103#
Fatal error: Cannot use string offset as an array in lalala/modx/core/cache/includes/elements/modsnippet/18.include.cache.php on line #2#
these lines is:
#103#(line 103 in original snippet) foreach ($data['items'] as $item) {
#162#(line 162 in original snippet) $placeholderPrefix.'id' => $data['album']['id'],
i've quick fixed by adding
if (empty($data)) return '';
right after line 48: $data = $modx->call('galItem','getList',array(&$modx,$scriptProperties));
TLDR: if u call gallery with non-existing album - it breaks with fatal error on ur site
latest modx, latest gallery
there's a fix
[ed. note: fen1kz last edited this post 11 years, 6 months ago.]