Skip to content

Conversation

alanhartless
Copy link
Contributor

Description

This PR prevents Mautic from crashing if something with enclosing % signs happens to be saved into the default unsubscribe and webview text tokens. Symfony treats these as parameters and will throw an exception when it can't find them. The PR encloses them so that Symfony will ignore them. Using enclosing percent signs should be avoided but this will at least prevent crashing.

Testing
Go to Configuration -> Email Settings and add %test% to one of the default text based settings such as the unsubscribe_text token body. Then try to save. The system will crash.

Manually edit /app/config/local.php to remove the %test% then delete the cache (app/cache/prod or app/cache/dev/). Refresh the page and it should load.

Apply the PR and save. This time the system shouldn't crash.

…a URL encoded brackets around a leadfield token, symfony would crash since it interprets it as a parameter.
@alanhartless alanhartless added bug Issues or PR's relating to bugs ready-to-test PR's that are ready to test labels Dec 25, 2015
@alanhartless alanhartless added this to the 1.3.0 milestone Dec 25, 2015
@alanhartless alanhartless modified the milestones: 1.3.0, 1.2.4 Jan 5, 2016
@alanhartless alanhartless added the T1 Low difficulty to fix (issue) or test (PR) label Jan 5, 2016
@escopecz
Copy link
Member

escopecz commented Jan 6, 2016

After the PR, the configuration does not crash, but I noticed a small issue. If I save the configuration once, the original %test% will became %%test%%. If I save again, it grows to %%%%test%%%%. Anyway, it is better than before so 👍

@escopecz escopecz added the pending-test-confirmation PR's that require one test before they can be merged label Jan 6, 2016
@alanhartless
Copy link
Contributor Author

@escopecz Can you test again? I improved the regex to prevent that.

@escopecz
Copy link
Member

escopecz commented Jan 7, 2016

It does the same as before. I check the code and I have there the code from your last commit.

EDIT: No, it only double the %% and it stays that way no matter how many times I save the config. That is the goal, right?

@alanhartless
Copy link
Contributor Author

@escopecz The goal was to change %test% to %%test%% only once but not %%test%% to %%%test%%% and %%%test%%% to %%%%test%%%% and so forth on each save. Is that still happening?

@escopecz
Copy link
Member

escopecz commented Jan 7, 2016

No, it's not happening. The goal is fulfilled. 👍

@vln104
Copy link
Contributor

vln104 commented Jan 18, 2016

Hi,

I was able to reproduce the issue. After applying the PR, %test% becomes %%test%% in the config text and remains as %%test%% after the second save.

alanhartless added a commit that referenced this pull request Jan 19, 2016
Prevent fatal error when email text based config settings have a % in them
@alanhartless alanhartless merged commit abd9d41 into mautic:staging Jan 19, 2016
@alanhartless alanhartless deleted the email-text-config-fix branch January 25, 2016 17:44
nileshlohar pushed a commit to nileshlohar/mautic that referenced this pull request Mar 28, 2025
CF-297 Golden template_Category_Edit popup is displayed in child instance for inherited resource
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 pending-test-confirmation PR's that require one test before they can be merged ready-to-test PR's that are ready to test T1 Low difficulty to fix (issue) or test (PR)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants