Skip to content

Contact Form: Prevent PHP notices when processing contact form in widget#6606

Merged
thingalon merged 1 commit intoAutomattic:masterfrom
christianwach:fix/contact-form-notices
Mar 24, 2017
Merged

Contact Form: Prevent PHP notices when processing contact form in widget#6606
thingalon merged 1 commit intoAutomattic:masterfrom
christianwach:fix/contact-form-notices

Conversation

@christianwach
Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request:

  • When a Contact Form is placed in a text widget, submissions generate PHP notices, e.g.:
[08-Mar-2017 15:00:41 UTC] PHP Notice:  Undefined index: before_widget in /path/to/wp-includes/widgets/class-wp-widget-text.php on line 75
[08-Mar-2017 15:00:41 UTC] PHP Notice:  Undefined index: before_title in /path/to/wp-includes/widgets/class-wp-widget-text.php on line 77
[08-Mar-2017 15:00:41 UTC] PHP Notice:  Undefined index: after_title in /path/to/wp-includes/widgets/class-wp-widget-text.php on line 77
[08-Mar-2017 15:00:41 UTC] PHP Notice:  Undefined index: after_widget in /path/to/wp-includes/widgets/class-wp-widget-text.php on line 81

This PR pre-populates the widget callback's $args array with dummy items that prevent these PHP notices.

Testing instructions:

Before:

  • Place a Contact Form in a text widget
  • Submit the Contact Form one or more times
  • Watch your logs fill up with notices

After:

  • Place a Contact Form in a text widget
  • Submit the Contact Form one or more times
  • Smile!

@jeherve jeherve added [Feature] Forms [Pri] Low [Status] Needs Review This PR is ready for review. Bug When a feature is broken and / or not performing as intended labels Mar 8, 2017
@jeherve jeherve changed the title Prevent PHP notices when processing contact form in widget Contact Form: Prevent PHP notices when processing contact form in widget Mar 8, 2017
Copy link
Copy Markdown
Contributor

@briancolinger briancolinger left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Mar 13, 2017
@thingalon thingalon merged commit bbb5a82 into Automattic:master Mar 24, 2017
@matticbot matticbot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Mar 24, 2017
@christianwach christianwach deleted the fix/contact-form-notices branch March 24, 2017 09:07
jeherve added a commit that referenced this pull request Mar 28, 2017
samhotchkiss pushed a commit that referenced this pull request Mar 29, 2017
* Readme: remove old release and add skeleton for 4.8.

* Changelog: add #6572

* Changelog: add #6567

* Changelog: add #6542

* Changelog: add #6527

* Changelog: add #6508

* Changelog: add #6478

* Changelog: add #6477

* Changelog: add #6249

* Update stable version and remove old version from readme.

* Changelog: add 4.7.1 to changelog.

* Readme: add new contributor.

* Sync: update docblock @SInCE version.

Related: #6053

* Changelog: add release post.

* changelog: add #6053

* Changelog: add #6413

* Changelog: add #6482

* Changelog: add #6584

* Changelog add #6603

* Changelog: add #6606

* Changelog: add #6611

* Changelog: add #6635

* Changelog: add #6639

* Changelog: add #6684

* Changelog: add #6710

* Changelog: add #6711

* Changelog: add #5461

* Testing list: update Settings UI feedback prompt.

Props @MichaelArestad

* Changelog: add #6789

* Changelog: add #6778

* Changelog: add #6777

* Changelog: add #6775

* Changelog: add #6755

* Changelog: add #6731

* Changelog: add #6721

* Changelog: add #6705

* Changelog: add #6702

* Changelog: add #6671

* Changelog: add #6637

* Changelog: add #6582

* Changelog: add #6566

* Changelog: add #6555

* Changelog: add #6529

* Changelog: add #6344

* Changelog: add #5763

* Changelog: add #5503

* Changelog: update #6637 changelog.

@see 40e115c#commitcomment-21523982

* Changelog: add #6699

* Changelog: add #6632

* Changelog: add #6769

* Changelog: add #6707

* Changelog: add #6590
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Feature] Forms [Pri] Low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants