Impossible to update from 2.16.0

Your software
My Mautic version is: 2.16.0
My PHP version is: Irrelevant

Your problem
My problem is: I cannot update to Mautic 2.16.2 nor to 2.16.1.

The error is always the same:

[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: Argument 1 passed to Mautic\CoreBundle\Helper\LanguageHelper::__construct() must be an instance of Mautic\CoreBundle\Helper\PathsHelper, instance of Mautic\C
oreBundle\Factory\MauticFactory given, called in /var/www/[redacted]/public_html/app/cache/prod/appProdProjectContainer.php on line 11412

Steps I have tried to fix the problem:

The first time the error appeared was migrating from 2.16.0 > 2.16.2.

Then I restored a snapshot taken before starting trying to upgrade and tried again to upgrade to version 2.16.1

 php public_html/app/console mautic:update:apply --update-package=2.16.1-update.zip

The same error happened.

How can I migrate to a new version of Mautic? Any ideas?

Hi there,

Please always share the information requested in the post template - we would not ask for it if it were irrelevant :slight_smile:

Have you cleared the cache? Was it successfully cleared? If not, what were the errors?

This line in the error above is referring to something in the cache directory:

called in /var/www/ [redacted] /public_html/app/cache/prod/appProdProjectContainer.php on line 11412

Adding the Github issue you raised so that they are connected and to avoid duplication:

1 Like

Thank you for your reply :slight_smile:

I know very well PHP and Symfony and the version I’m running is not relevant.

Anyway it is PHP7.

I did a lot of tests…

I will update both the post and the issue with all the details.

I cleared the cache, before and after, I tried to update the schema (strange behavior: it wanted to remove some indexes and add them again, also if the schema tool of Mautic reports there are nothing to update).

I did all from the command line, but didn’t had the time to dig in the problem…

Now I found another way: test to manually update the files…

I will update the posts with all the details.

I wrote the post thinking that someone else had already faced the issue, but I think I’m the first one, so I have to solve it on my own :scream:

I know very well PHP and Symfony and the version I’m running is not relevant.

I don’t doubt it, however please be respectful of those who may try to support you by reproducing the issue with the same environment, or come to threads later to see if it matches their situation. It takes a second to add if you already know what you are doing, so there is no reason not to follow the requested steps.

Looking forward to reading the follow up.

1 Like

My PHP version is 7.2, if you need to know it.

Please, reopen the issue on GitHub: mine is a problem related to upgrading, not about a general feature.

If the upgrade path is broken (as it is), this is not something that should fall in the general rules about support.

@aerendir I can reproduce this error. The LanguageHelper in the error message triggered me to set Mautic to a different language than the default (default is English US if I remember correctly). That indeed triggers the error.

When I set the Mautic language to its default (English US) the update succeeds without issues:

denni@mautic2160-web:/var/www/html$ app/console mautic:update:apply
Are you sure you wish to update Mautic to the latest version? y
Step    7 [============================] Success! You are now running version 2.16.3 of Mautic.

Can you confirm if that solves the error for you as well? If it does, I’ll check if this bug is still present in Mautic 3 and so if we need to re-open your GitHub issue. :slight_smile:

1 Like

I think I didn’t changed the default language…

Anyway I’ll investigate further and update you.

Thank you for your hint!

Hello there,
I have got the same error on my side, on Ubuntu Server 18.04 running with PHP 7.2. I tried to update from version 2.15.3 to 2.16.3.
I switched the language to English US, deleted the cache, switched also the language in my profile (account), deleted the cache again.

Then I typed:
app/console cache:clear
app/console mautic:update:find
It tells me the 2.16.3 version is available, but running app/console mautic:update:apply leads me to the error:

“[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: Argument 1 passed to Mautic\CoreBundle\Helper\LanguageHelper::__construct() must be an instance of Mautic\CoreBundle\Helper\PathsHelper, instance of Mauti
c\CoreBundle\Factory\MauticFactory given, called in /var/www/html/mautic/app/cache/prod/appProdProjectContainer.php on line 11318”

I don’t feel like moving forward to Mautic 3 since I’m not sure it has been totally and successfuly updated. @aerendir did you find a solution finally?
Thank you.

have a look at an earlier post of mine… might help: Updating from 2.15.3 to 2.16.3

@randomguy, I didn’t tried since then, so I don’t know…

I think I will try again tomorrow… I don’t know… I’m trying Sendinblue, but Mautic is more advanced: I don’t want to change infrastructure :frowning:

@mikew, unfortunately, I think the problems you incurred are unrelated to the one in this thread…

Anyway, reading again your post, I noticed you are JUMPING from 2.15.3 to 2.16.3: you cannot do this, Mautic is not Wordpress.

You have to apply updates one by one, and better if you apply them from the command line.

Here you can find all the releases: https://github.com/mautic/mautic/releases

I’ve tried to change the language to the default one “English US”, both in general Mautic’s setting and also in my own profile, but the error persists…

I don’t think the problem is this…

Ok, I finally was able to update from 2.16.0 to 2.16.1! :tada:

After a lot of debugging, I finally I guessed the problem was not a configuration issue but a filesystem issue: it was so strange that the container passed a wrong object to Mautic\CoreBundle\Helper\LanguageHelper::__construct().

So I thought the problem was of files…

How I solved the issue

  1. I downloaded again the package of my current version (2.16.0) from here https://github.com/mautic/mautic/releases/tag/2.16.0
    I downloaded file 2.16.0.zip (and NOT 2.16.0-update.zip).
  2. I made a backup of the file app/config/local.php
  3. I completely removed all the files from the current installation: they were corrupted or not correct anyway (maybe due to a past update not correctly applied)
  4. I extracted the files from 2.16.0.zip and then uploaded them in place of the old ones
  5. Uploaded again the file app/config/local.php
  6. Ensured files and folders permissions and owners were the right ones:
cd /var/www/my/mautic/installation/public_html
find ./ -type d -exec chmod 755 {} \;
find ./ -type d -exec chown www-data {} \;
find ./ -type f -exec chmod 644 {} \;
find ./ -type f -exec chown www-data {} \;

Finally, I recreated the cache:

php app/console cache:clear

At this point, I was ready to update:

  1. I downloaded the UPDATE PACKAGE for version 2.16.1 (2.16.1-update.zip from here: https://github.com/mautic/mautic/releases/tag/2.16.1)
  2. Then I ran the update command
php app/console mautic:update:apply --update-package=/var/www/my/mautic/installation/2.16.1-update.zip

And this time all went well!

Are you sure you wish to update Mautic to the latest version? y
Step    6 [============================] Success! You are now running version 2.16.1-update.zip of Mautic.

As final steps, and to prevent those kind of errors to happen again, I’m going to set again files and folders permissions, just to be sure that the next update will run smoothly!

Hoping this will help others to update! :muscle:

1 Like

Thanks for sharing your solution @aerendir! Just wanted to chime in here to say that we had the same issue yesterday on Ubuntu 16.04 (PHP 7.0) while trying to update a 2.14.0 instance to 2.16.5. The LanguageHelper issue popped up. This is what worked for us:

  • Start the upgrade
  • Hit the LanguageHelper error
  • Run the following commands (in the root of your Mautic installation directory):
wget https://github.com/mautic/mautic/releases/download/2.16.5/2.16.5-update.zip
php bin/console mautic:update:apply --update-package=2.16.5-update.zip

That fixed it and it also ran the database schema updates. So it’s basically re-running the same update again that did the trick.

2 Likes