We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Hi all I updated a site to latest MODX and get this error if I try to go to the manager:

    Fatal error: Access to undeclared static property: Smarty::$_CHARSET in /var/sites/m/moorparknorthwoodhouses.forsale/public_html/core/model/smarty/plugins/modifiercompiler.escape.php on line 37

    In this file I see this at line 37:

    try {
            $esc_type = smarty_literal_compiler_param($params, 1, 'html');
            $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);
            $double_encode = smarty_literal_compiler_param($params, 3, true);
    
            if (!$char_set) {
                $char_set = Smarty::$_CHARSET;
            }
    


    How can i fix this, I emptied the cache folder, tried reinstalling again and disabling most plugins...
      MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
      DESIGNfromWITHIN, MPThemes and Any Screen Size
      Follow me on Twitter | Read my blog | My code on GitHub
    • Menno
      I haven't ever looked into the Smarty code but just looking at the code the var $_CHARSET is either not defined or defined incorrectly. You could log what $_CHARSET is and then review. Another option maybe try changing
      Smarty::$_CHARSET
      to
      Smarty::_CHARSET


      File in reference: https://github.com/modxcms/revolution/blob/2.x/core/model/smarty/plugins/modifiercompiler.escape.php [ed. note: jgulledge19 last edited this post 7 years, 10 months ago.]
        • 3749
        • 24,544 Posts
        Upgrading MODX should have fixed this, so it might be a cache issue. It might suggest that the update was not complete.

        Otherwise, I think this will work:

        Try changing it to:

        $_SMARTY_RESOURCE_CHAR_SET


        You'll have to change it in more than one place.
          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
          • 36549
          • 572 Posts
          Hi,

          I am getting this too.
          It's with a 2.2.4 site. I tried to upgrade but some of the bespoke code didn't work so i restored the site from a back up. this error persists even after clearing the cache manually.
          Should i change the code as @BobRay suggests?
            www.9thwave.co.uk
               WEB | DESIGN | PRINT
            • 3749
            • 24,544 Posts
            I'd recommend updating with the UpgradeMODX extra and fixing the bespoke code. It's usually pretty easy. Sometimes as easy as adding a return statement at the end of your code.

            There have been some important security fixes since that version.
              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
              • 36549
              • 572 Posts
              Thanks for getting back to me.
              I will try again with an update ( i am using Softaculous for the upgrade) and see if i can figure out what's happening.
              It's basically a bespoke top menu item that seems to have disappeared in the update. I'll report back anyway.
                www.9thwave.co.uk
                   WEB | DESIGN | PRINT