Automattic / Automattic/jetpack
Contact Form: wrong subject line when site title includes an apostrophe
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Steps to reproduce:
1. Create a default form (no custom options, just add the form without editing the form content) using the form builder: the shortcode will be as follows:
```
[contact-form][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Website' type='url'/][contact-field label='Comment' type='textarea' required='1'/][/contact-form]
```
1. Go to Settings > General in your dashboard, and change your site title to include an apostrophe, e.g. "the cat's pajamas"
2. Insert a default form again: the shortcode now includes a subject line, including a square bracket:
```
[contact-form subject='[the cat%26#039;s pajamas'][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Website' type='url'/][contact-field label='Comment' type='textarea' required='1'/][/contact-form]
```
Reported in [#2065950-org](https://wordpress.org/support/topic/contact-email-subject-garbled-if-site-title-has-apostrophe?replies=5#post-6005103)
Contributor guide
Research direction
Reproduce the issue by creating a default contact form in the form builder, then set the site title in Settings > General to include an apostrophe and insert the form again. Compare the generated subject shortcode with the expected subject text, and confirm the fix by repeating the reported steps without the square bracket or garbled apostrophe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100