Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to M5 breaks Mautic if mailer password contains special chars #13236

Closed
1 task done
putzwasser opened this issue Jan 16, 2024 · 10 comments · Fixed by #13256
Closed
1 task done

Migration to M5 breaks Mautic if mailer password contains special chars #13236

putzwasser opened this issue Jan 16, 2024 · 10 comments · Fixed by #13256
Labels
bug Issues or PR's relating to bugs mautic-5 Relates to Mautic 5.x

Comments

@putzwasser
Copy link
Contributor

putzwasser commented Jan 16, 2024

Mautic Version

5.0.x series

PHP version

8.1

What browsers are you seeing the problem on?

Not relevant

What happened?

Updating from M4 to M5 the update script creates the mailer_dsn config key for you.

There is a bug in converting special chars properly:

  • Given my Amazon SES password looks like this: sometring/SOMEotherSTRING.
  • The update process/migration will transform it to: sometring&2FSOMEotherSTRING, i.e., urlencode it.

The resulting config/local.php holds now a faulty mailer_dsn:

<?php
$parameters = array(
    // [...]
     'mailer_dsn' => '...://MYUSER:sometring%2FSOMEotherSTRING...',
};

This will lead to the following critical PHP error:

$ php bin/console

                                                                                                                        
 [WARNING] Some commands could not be registered:                                                                       
                                                                                                                        

In AppKernelProdContainer.php line 11284:
                                                      
  The parameter "2FSOMEotherSTRING" must be defined.  
                                                      

Or in the logs:

console.CRITICAL: An error occurred while using the console. Message: "The parameter "2FSOMEotherSTRING" must be defined." {"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException(code: 0): The parameter \"2FSOMEotherSTRING\" must be defined. at /.../mautic/docroot/var/cache/prod/Container7PjiqWi/AppKernelProdContainer.php:11284)","message":"The parameter \"2FSOMEotherSTRING\" must be defined."} {"hostname":"mautic.local","pid":24898}

The single ampersand in the mailer_dsn config key leads Mautic/Symfony to believe there is a parameter that is not defined, hence the error.

The hotfix after updating is commenting out the config key mailer_dsn in local.php and re-configure your mailer.

How can we reproduce this issue?

  1. Use M4
  2. Set up a email transport with a password that contains special chars that need urlencoding
  3. Update to M5
  4. run bin/console or try to access the dashboard.
  5. Mautic should fail yielding the mentioned error message

Relevant log output

No response

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct




Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.

@putzwasser putzwasser added bug Issues or PR's relating to bugs needs-triage For new issues/PRs that need to be triaged labels Jan 16, 2024
@dsp76
Copy link

dsp76 commented Jan 16, 2024

seems somehow be related to #12256 ?

@putzwasser
Copy link
Contributor Author

putzwasser commented Jan 17, 2024

I suspect it's only tangential.

I see it as:

@mollux
Copy link
Contributor

mollux commented Jan 20, 2024

@putzwasser @dsp76 this is indeed a bug, the value is incorrectly stored if any propery of the dsn contains a special character.

I'll create an MR to address this.

@mollux
Copy link
Contributor

mollux commented Jan 20, 2024

@putzwasser @dsp76 it's indeed a different issue.

I fixed the migration issue in #13256, can you test this out?

@mollux mollux removed this from the 5.0.3 milestone Jan 20, 2024
@mollux mollux added mautic-5 Relates to Mautic 5.x and removed needs-triage For new issues/PRs that need to be triaged labels Jan 20, 2024
@putzwasser
Copy link
Contributor Author

@mollux Happy to, but, currently, I have no instance that I could try this out on.

When M5 fully supports SES, etc. I can update another instance. Then I can report back on this.

@omert37
Copy link

omert37 commented Jan 22, 2024

Tried another upgrade attempt, this time to 5.0.2.
Migrated from 4.4.11 to 5.0.2 (successfully with "Success!" message that I now have version 5.0.2) and it would seem that this is my problem as well as my AMAZON SES password contains forward slashes.
After upgrade I get the red "offline" message (see screenshot) with the ""2FXXXXXX" is not defined" (when calling console commands such as cache:clear) message referencing a section in my AMAZON SES password (Just like when I upgraded to 5.0.1 last week).
When I comment out the 'mailer_dsn' line I am able to 'cache:clear' successfully BUT the red offline message (screenshot) is still there when I surf over to mautic from my browser.
mautic_screenshot

@putzwasser
Copy link
Contributor Author

If you're certain that mailer_dsn doesn't cause the problem you need to check the logs. There's another issue at play, then.

@mautibot
Copy link

This issue has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/upgrade-from-mautic-4-4-11-5-0-2-problem/30602/1

@putzwasser
Copy link
Contributor Author

#13256 fixes this, I guess.

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If this issue is continuing with the lastest stable version of Mautic, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs mautic-5 Relates to Mautic 5.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants