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

Fix: Escape double quotes in emailTemplateOptions #6938

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

kjohnson
Copy link
Member

@kjohnson kjohnson commented Sep 13, 2023

Description

This PR escapes the nested array properties for FormSettings::$emailTemplateOptions when converting the form settings to JSON.

Testing Instructions

  1. Create a v2 form
  2. Migrate the form to v3
  3. Try to load design mode

@kjohnson kjohnson marked this pull request as ready for review September 13, 2023 18:25
$self = new self();
$array = json_decode($json, true);

return $self::fromArray($array);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FormSettings::fromArray() is a static method and creates its own instance of the FormSettings object.

@kjohnson kjohnson changed the title Fix: Escape double quotes in nested properties Fix: Escape double quotes in emailTemplateOptions Sep 13, 2023
@jonwaldstein
Copy link
Contributor

jonwaldstein commented Sep 13, 2023

@kjohnson im getting this now:

[13-Sep-2023 19:03:19 UTC] PHP Fatal error:  Uncaught TypeError: addslashes(): Argument #1 ($string) must be of type string, array given in /Users/jonwaldstein/Sites/givewp/wp-content/plugins/give/src/DonationForms/Properties/FormSettings.php:261
Screenshot 2023-09-13 at 3 01 50 PM

@kjohnson
Copy link
Member Author

@jonwaldstein I updated the escaping to be recursive.

@kjohnson kjohnson merged commit e07af08 into develop Sep 14, 2023
20 checks passed
@kjohnson kjohnson deleted the fix/email-template-options-syntax-error branch September 14, 2023 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants