We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22656
    • 121 Posts
    We have a snippet, called "global_functions", which contains most of the php functions used in other snippets accross the site. we found this way to be the best to organize lots of PHP functions we have.

    Anyway, just now, the whole site went down, with the error
    Parse error: syntax error, unexpected '<' in \core\cache\includes\elements\modsnippet\56.include.cache.php on line 1429
    


    Snippet id 56 is our global_functions, however its code finishes on line 1422!
    Clearing the cache solved the problem and the site went back up.
    One thing I noticed is that this particular snippet has no closing PHP tag (?>). Actually the majority of our snippets havent got these closing tags. Could this be the source of this problem?

    I've noticed this happened on another revo site too once, where clearing the cache also solved the problem.
      • 22656
      • 121 Posts
      Okay, I've just had it again, when adding new snippets to the site.
      This time i've downloaded the cache snippet in question before I cleared the cache. It seems to happen when adding things to the installation, like new snippets.

      Parse error: syntax error, unexpected '<' in \core\cache\includes\elements\modsnippet\50.include.cache.php on line 511

      I have the metaX plugin installed on the revo installation. It generates extended metatags for each page. It is only a simple snippet which you place in your template, which I had renamed and included extra code in. Just opened the 50.include.cache.php and noticed my metaX snippet is included TWICE in there?

      50.include.cache.php has the following on and around line 511:
      }
      <?php
      function elements_modsnippet_50($scriptProperties= array()) {


      This is exactly the same as what appears on line 1 in the same cached file.
      Why is this particular snippet repeating itself twice in here?
      Is it something to do with caching and the way the snippet is called:

      I have a chunk in the template being called:
      [[$meta-stuff]]

      This chunk is then calling the metaX snippet within it like so:
      [[!metaX-mod]]



        • 3749
        • 24,544 Posts
        I don't know what would cause that, but snippets should definitely not have a closing tag, especially if they are intended to be included.

        You might try wrapping each snippet (if you haven't already) in:

        if (! function_exists('SnippetName') ) {
        
        }


        2.1.3 is probably not ready for prime time, so you might consider going to 2.1.0-rc3, which should be more stable.



        ---------------------------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
        MODx info for everyone: http://bobsguides.com/MODx.html
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 22656
          • 121 Posts
          to be honest we do not mind it too much, we are on the site most of the time so when we notice we can clear the cache.

          I was under the impression it could be something we are doing that is causing this, however it seems to be a bug in the core. Looks like the caching mechanism is repeating the same snippet in the cache file twice by the looks of it.