Have just upgraded website to v3.0 but in doing so received many deprecation warnings about an extra called Smarty. System upgraded OK but how to I get rid of Smarty? It does not appear in the list of extras but was presumably “removed” by package manager leaving a host of problems including many files. If I delete the files the manager becomes unavailable and I have had to restore from backup.
Step to reproduce
How to reproduce the issue, including custom code if needed.
Observed behavior
An A4 page of errors was produced but the site still upgraded to V3.0
Expected behavior
How it should behave after following the steps above.
Here’s a few examples of the errors
Deprecated
: Creation of dynamic property Smarty_Internal_Template::$compiled is deprecated in
/home/teignmou/subs/revo/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
on line
719
Deprecated
: Creation of dynamic property Smarty_Internal_Template::$compiler is deprecated in
/home/teignmou/subs/revo/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
on line
719
Deprecated
: Creation of dynamic property Smarty_Internal_Extension_Handler::$_codeFrame is deprecated in
/home/teignmou/subs/revo/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php
on line
182
Deprecated
: Creation of dynamic property Smarty_Internal_Extension_Handler::$getLiterals is deprecated in
/home/teignmou/subs/revo/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php
on line
182
What version of MODX did you install? 3.0.4? And what version of PHP are you using?
Where do you see the “deprecation warnings”? On screen? Or in the MODx error log?
You don’t upgrade the library yourself. The MODX developer do this, when they create a new MODX version.
Upgrading to MODx 3.0.0 running PHP 8.1.16
The errors showed up on screen as part of the upgrade process and I saved them to a file.
Just looked at the post install error log and here is the first 4 lines
[2023-11-19 14:17:10] (ERROR @ /home/teignmou/subs/revo/setup/includes/modinstallsettings.class.php : 164) PHP warning: fopen(/home/teignmou/subs/revo/core/cache/setup/settings.cache.php): Failed to open stream: No such file or directory
[2023-11-19 14:17:14] (ERROR @ /home/teignmou/subs/revo/core/cache/setup/smarty/58b3ab5de1abfc38c14a01c36cb9568efb7f3a78_0.file.complete.tpl.php : 30) PHP warning: Undefined array key “errors”
[2023-11-19 14:17:14] (ERROR @ /home/teignmou/subs/revo/core/cache/setup/smarty/58b3ab5de1abfc38c14a01c36cb9568efb7f3a78_0.file.complete.tpl.php : 30) PHP warning: Attempt to read property “value” on null
[2023-11-19 14:17:16] (ERROR @ /home/teignmou/subs/revo/core/include/deprecated.php : 11) PHP warning: Cannot declare class xPDO, because the name is already in use
[2023-11-19 14:17:16] (ERROR @ /home/teignmou/subs/revo/core/include/deprecated.php : 12) PHP warning: Cannot declare class xPDOCriteria, because the name is already in use
[2023-11-19 14:17:16] (ERROR @ /home/teignmou/subs/revo/core/include/deprecated.php : 13) PHP warning: Cannot declare class xPDOSimpleObject, because the name is already in use
Upgrading to the current version (MODx 3.0.4) may help.
(There is no point in installing MODx 3.0.0 at this time. The version is outdated and buggy.)
In general, the deprecation warnings are just warnings. The code should still run correctly.
Maybe change display_errors in the PHP/server configuration, so that you don’t see these warnings on screen. You could also change error_reporting to exclude warnings.
I thought the advice was to install the 3.0.0 version first and then upgrade to later versions. Anyway, I am now running 3.0.0 on my test site and it runs even if I do have errors. I’ll follow your advice and go straight to 3.0.4 but not tonight because I have commitments.
I thought I’d comment on this, since the “myth” is built in to UpgradeMODX (I prefer the term “lore” ).
The x.0 versions are where breaking changes like modifications to the MODX database happen. In theory, a later version makes all the changes that an x.0 version makes, but in practice, it hasn’t always worked.
I’ve seen a number of cases where users skipped the x.0 version, then had error messages related to missing fields in the db, or other changes that weren’t made. This only happened to people who skipped the x.0 version, and installing the x.0 version fixed it.
It’s quite possible that this never happens any more, but AFAIK, there’s no harm in installing the x.0 version to be on the safe side.
Thanks Bob I was sure I’d seen the advice somewhere. Pleased to know that I am following yours.
Back to the main issue which is Smarty. I found this modxSmarty 1.0.3-beta | MODX Extras which seems to indicate that smarty was once an extra which one of my predecessors as webmaster seems to have tried on our test website.
I have compared directories on live and development sites and found that I have a directory on the develpment site subs/revo/core/vendor/smarty which does not exist on the live site. I am thinking of deleting this but would appreciate advice as to whether or not to do so. Also, is it likely that this will solve my problems or will I need to look in the database.
Thats interesting because only my development site has the directory core/vendor/smarty/smarty whereas both live and dev have this core/cache/setup/smarty. Confused!
That explains it. My dev site is now running 3.0.0 (not for long) and has the core/vendor subdirectory whereas my live site is still on 2.8.6 and, now you have mentioned it, I have found core/model both with a smarty sub folder. I just hope the deprecation errors go away when I get both sites to 3.0.4
I can’t remember if this is true of 3.0.0, but later versions have a separate log for deprecation errors. It can grow to be very large. You can turn it off by changing the log_deprecated System Setting, though it’s often helpful to see what’s in there.