Removing an extra which is causing problems with upgrade to 3.0


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.


MODX 2.8.6 to MODX 3 upgrade

You can’t, or else MODX won’t work

Smarty is not an extra. It’s a PHP library that MODX uses for templating.

So why am I getting all the deprecation errors?

or put another way, if it is a library how do I upgrade the library to make it compatible with v3

Here’s a few examples of the errors
: Creation of dynamic property Smarty_Internal_Template::$compiled is deprecated in
on line
: Creation of dynamic property Smarty_Internal_Template::$compiler is deprecated in
on line
: Creation of dynamic property Smarty_Internal_Extension_Handler::$_codeFrame is deprecated in
on line
: Creation of dynamic property Smarty_Internal_Extension_Handler::$getLiterals is deprecated in
on line

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.

Very many thanks for your help

I believe this is more a “myth”, and not the official advice.

3.03.3 it is then. I’ll do it tomorrow🤞

No! This was just the latest version when the question was asked (10 months ago).
Currently 3.0.4 is the latest version. Install that one.

I thought I’d comment on this, since the “myth” is built in to UpgradeMODX (I prefer the term “lore” :wink: ).

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.

1 Like

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.

All of my MODX 3.x sites have this folder so I’d imagine it’s required.

If your site has the modxSmarty extra installed you should see plugin called “modxSmarty” in your elements tab.

More likely though, is that the errors you see are to do with the Smarty library the @halftrainedharry mentioned.

I received these on 3.0.0 sites.

I think the errors were fixed on a later version and certainly I no longer see them on 3.0.4

There are other improvements too - so might as well go for 3.0.4

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!

Every MODX 3 installation has the folder core/vendor/smarty. It’s an essential dependency of MODX. The manager won’t work correctly without it.

In MODX 2.x, the corresponding folder was core/model/smarty.

This is a directory in the cache folder that only contains cached smarty-template and not the code of the library.

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.