We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    This just started happening for me on the tx cloud:

    This code in a snippet throws a server 500 error (works fine on other servers):

    if (!function_exists("my_debug")) {
        function my_debug($message, $clear = false) {
            return $message;
        }
    }


    This code doesn't:

    if (!function_exists("mydebug")) {
        function mydebug($message, $clear = false) {
            return $message;
        }
    }


    The code above is the entire code of the snippet (uncached). The page has a minimal template:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>[[++site_name]] | [[*pagetitle]]</title>
        <base href="[[++site_url]]" />
    </head>
    <body>
    [[*content]]
    </body>
    </html>


    Also, a minimal page content:

    <p>Hello Tester</p>
    [[!Test]]
    [ed. note: BobRay last edited this post 13 years, 5 months ago.]
      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
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Tried it and it's working fine on ams cloud.
        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
        Interesting. I wonder if it could be a plugin of mine. It worked fine on a clone of the same site at a different server, but I'm not sure all the same plugins are enabled.

        [update] Never mind. I had a plugin with the same function, but without the function_exists() wrapper. Any change in the function name would have solved it.

        [ed. note: BobRay last edited this post 13 years, 5 months ago.]
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Sounds like you need to make yourself a basic function library.
            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
            If I did, it would only have one function in it. wink

            It's as easy to paste it as to remember where to include it from. I remove it or comment it out in the finished code, I was working on several projects at once (what else is new) and it wasn't wrapped in one old plugin I was refactoring -- it is now.
              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