Subscribe: RSS
  • so i've placed [-[!Gallery]-] in my resource (parameters doesnt matter)
    this is supposed to show all albums (and it shows laugh) 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 1 year, 11 months ago.]
    • Hi Fen1kz,

      thanks a lot for this q&d fix, works like charm.

      Have you filed a bug report as well?
      • hey, sorry i dont know where to bugreport this, so i posted only via this forum =(
          • I don't usually get involved in religious or political issues, but having survived an abusive childhood, this touches close to home. https://www.facebook.com/StealthyFreedom
          • huh, thank you, posted bug @ github https://github.com/splittingred/Gallery/issues/240