<![CDATA[ PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET - My Forums]]> https://forums.modx.com/thread/?thread=104730 <![CDATA[PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset?page=2#dis-post-563256
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?]]>
terrybarth Dec 14, 2018, 09:05 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset?page=2#dis-post-563256
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563306
If things work with 2.6.0, upgrade to 2.6.5 to get the security fix. Then you might want to wait for 2.7.1 when some of the error log issues on deprecated methods will be straightened out.

PS: I've sent you an email on this.]]>
BobRay Dec 18, 2018, 07:33 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563306
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563304
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?]]>
terrybarth Dec 18, 2018, 07:15 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563304
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563303
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.
]]>
BobRay Dec 18, 2018, 07:02 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563303
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563295
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.]]>
terrybarth Dec 17, 2018, 03:59 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563295
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563283
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.]]>
terrybarth Dec 16, 2018, 04:06 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563283
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563274
Have you tried re-doing the Smarty fix? The attempted upgrade may have undone it.

]]>
BobRay Dec 15, 2018, 09:47 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563274
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563272
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?]]>
terrybarth Dec 15, 2018, 05:42 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563272
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563271
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.]]>
terrybarth Dec 15, 2018, 04:24 PM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563271
<![CDATA[Re: PHP Fatal error: Uncaught Error: Access to undeclared static property: Smarty::$_CHARSET]]> https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563262
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]]>
BobRay Dec 15, 2018, 05:20 AM https://forums.modx.com/thread/104730/php-fatal-error-uncaught-error-access-to-undeclared-static-property-smarty-charset#dis-post-563262