On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I'm really stuck on this one.

    Client reports slide show on their site is not working, but don't know when it first happened.

    Logging into the manager produces a white page with errors (below). Front-end is working except for slideshow.

    This is an old site running 2.4.2
    Hostmonster updated PHP to 7.0 recently
    Error messages appears on white page and in manager error log.
    Changed php back to 5.6, then get 500 server error
    Removing .htaccess has no effect.
    Restored .htaccess
    Setup PHP back to 7.0, original error message returns (below)
    Disabled all plugins manually via the database, no effect
    Manually upgraded to 2.4.3, no effect
    Manually upgraded to 2.4.4, no effect (according to forum entries, an issue related to this was fixed in this version)

    I've manually cleared the cache after each of these steps and I'm using incognito in Chrome

    As it happens I found this very issue posted by me two years ago 2 1/2 years ago, unfortunately, I didn't document any resolution.

    https://forums.modx.com/thread/100184/access-to-undeclared-static-property-smarty-charset-in

    [14-Dec-2018 14:42:25 America/Chicago] PHP Fatal error:  Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET in /home2/xxxxx/public_html/core/model/smarty/plugins/modifiercompiler.escape.php:37
    Stack trace:
    #0 /home2/xxxxx/public_html/core/model/smarty/sysplugins/smarty_internal_compile_private_modifier.php(51): smarty_modifiercompiler_escape(Array, Object(Smarty_Internal_SmartyTemplateCompiler))
    #1 /home2/xxxxx/public_html/core/model/smarty/sysplugins/smarty_internal_templatecompilerbase.php(271): Smarty_Internal_Compile_Private_Modifier->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL)
    #2 /home2/xxxxx/public_html/core/model/smarty/sysplugins/smarty_internal_templatecompilerbase.php(123): Smarty_Internal_TemplateCompilerBase->callTagCompiler('private_modifie...', Array, Array)
    #3 /home2/xxxxx/public_html/core/model/smarty/sysplugins/smarty_internal_compile_private_print_expression.php(68): Smarty_Internal_TemplateCompilerBase->compileTag('private_modifie...', Array, Array)
    #4 /home2/xxxxx/publi in /home2/spmtrans/public_html/core/model/smarty/plugins/modifiercompiler.escape.php on line 37


    Any suggestions?
    • Some wild guesses:

      Try changing any occurrences of $_CHARSET in that file from

      $_CHARSET;


      to

      $_SMARTY_RESOURCE_CHAR_SET;


      If that doesn't work, try changing them all to:

      'UTF-8'


      (assuming that's what your DB is set to)
        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
      • [Update] Here's a much better solution:

        Don't mess with that compilermodifier file. Add this line to the class variables of the smarty class file.

        public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;


        It doesn't really matter where you add that line, as long as it's in the long list of constants and variables at the top of the class below this line (and not inside a comment section):

        class Smarty extends Smarty_Internal_TemplateBase
        {


        The file is: core/model/smarty/Smarty.class.php
          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
        • Bob

          Thank you!

          I didn't find this in the Smarty.class.php file
          class Smarty extends Smarty_Internal_TemplateBase
          {

          So I added it here:
          /**
           * This is the main Smarty class
           */
          class Smarty extends Smarty_Internal_Data {
            
            public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;
          

          Seemed to do the trick.
          • Perhaps this is unrelated to the original issue, but it is the next event in my efforts to get this site up to date.

            Modx 2.4.4 was working with all the plugins reactivated. I wanted to use UGM to get to 2.5.0. I tried updating the snippet properties to show more versions so I could select 2.5.0, but I couldn't get that to work. I updated the number of versions to show and the time to check to 1 minute. But UGM still did not show more than five versions back.

            So I updated the UGM extra, refreshed the dashboard and now when I click on UGM I can see the older versions and I select 2.5.0. UGM starts running, after a few minutes, an error pops up, something about a problem with the connector and 2.5.0. The only option is to click OK to continue. The upgrade progress bar is stalled. After 10 minutes, progress is still stalled, I refreshed the dashboard and got logged out.

            Now when I login in it says "The username or password you entered is incorrect". I manually cleared the cache, I'm still using incognito. After several attempts, same error. I checked the database user attributes and it shows zero failed logins and I'm not blocked.

            Now I'm stuck again. Ideas?
            • That could be related, since the Smarty issue was related to the Login processor.

              Have you tried re-doing the Smarty fix? The attempted upgrade may have undone it.

                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
              • The Smarty fix was not in the file and I now see the original line you referenced so the file has been updated. I've added the fix, but still can't login in.

                Should I try to upgrade again manually?

                Update.

                I just realized, adding the fix didn't save for some reason. I've confirmed the update this time. Now I'm getting a 500 error on the manager. Rename the .htaccess has no effect. [ed. note: terrybarth last edited this post 9 months, 4 weeks ago.]
                • I removed the line and the login page reappears but still won't accept any login. I reviewed the smarty.class file again and found the line of code / fix already in the file so the failed update did replace the file but it already includes that line of code in question.

                  I also noticed several php errors in the log. So I changed php version back to 5.6, disabled all the plugins and cleared the cache. Now loading the front-end or attempting to login generates no errors in the error log in the root folder or in the manager folder.

                  So I'm still stuck at the login.
                  • Sorry for the delay.

                    Make sure that $_CHARSET is not defined twice in the Smarty class file.

                    If it's a newer version, it could already be defined and adding the line I suggested would could define it twice, which would throw an error.
                      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
                    • Yes, it created a 500 error. So now it is declared just once.

                      I don't know how to investigate this login problem since there are no errors in the log and the database isn't even showing any failed logins. Perhaps something got corrupted during the failed upgrade?

                      Do you think manually running an upgrade might help? Current version or to the next version? Will that just muck it up more?