We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29902
    • 72 Posts
    Im in modx revo 2.2.13.

    This is a special site we have. When I am editing a snippet i see that the start php tag is missing. If I add the start tag and save it just dissapeares. when I see in the cache files i see a code.

    I find this code in all the cache.php snippets and plugins in core/cache/scripts/elements/modplugin
    <?php return 'function elements_modplugin_1($scriptProperties= array()) {
    global $modx;
    if (is_array($scriptProperties)) {
    extract($scriptProperties, EXTR_SKIP);
    }


    This is in a site i have, but in another site its not like this.

    In backend in Revo i use Codemirror but I cannot see the start tag, it looks like this code over here is injected when I save the snippet or plugin.

    Have you seen it before?
      ...I believed it was Friday...
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Yes, that's just loading any properties for the plugin, if there are any.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 3749
        • 24,544 Posts
        MODX removes the PHP start tag (and end tag) before displaying code in the Manager. It adds the start tag back when creating the cache file. The extract() function also creates local variables from the $scriptProperties array, though I'm not sure why -- AFAIK, they're almost never used.

        Definitely not a hacking attempt.
          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