Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#48943 closed defect (bug) (fixed)

`comment_form()` expects optional "email" field to be passed.

Reported by: mat-lipe's profile Mat Lipe Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3.1 Priority: normal
Severity: normal Version: 5.3
Component: Comments Keywords: has-patch
Focuses: template Cc:

Description (last modified by SergeyBiryukov)

Ticket #47975 introduced a requirement to the comment_form template tag of a passed field['email'] argument.

When using comment_form without passing field['email'] to the $args parameter you get the following notice level error.

Undefined index: email
\wp-includes\comment-template.php:2440

I have confirmed the issue does not exist on WP 5.2.4.

I have included a patch which simply checks for the existence of the email array key before using it.

Attachments (2)

comment-template.php.diff (701 bytes) - added by Mat Lipe 5 years ago.
Patch the /wp-includes/comment-template.php file
48943.diff (717 bytes) - added by audrasjb 5 years ago.
Refreshed patch against trunk

Download all attachments as: .zip

Change History (9)

@Mat Lipe
5 years ago

Patch the /wp-includes/comment-template.php file

#1 @Mat Lipe
5 years ago

I should point out this only happens when the fields is provided as an argument without the "email" key. If you do not provided fields the defaults fill in the "email" key for you and this error does not occur.

#2 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#3 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.3.1

#4 @audrasjb
5 years ago

  • Keywords needs-refresh added

#5 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 46885:

Comments: Avoid a PHP notice in comment_form() if the email field is not set.

Follow-up to [46090].

Props mat-lipe.
Fixes #48943.

#6 @SergeyBiryukov
5 years ago

In 46886:

Comments: Avoid a PHP notice in comment_form() if the email field is not set.

Follow-up to [46090].

Props mat-lipe.
Merges [46885] to the 5.3 branch.
Fixes #48943.

@audrasjb
5 years ago

Refreshed patch against trunk

#7 @audrasjb
5 years ago

  • Keywords needs-refresh removed

Ah nice, thanks Sergey, you beat me by committing it directly :D

@mat-lipe welcome to WordPress Trac and thank you for your patch!

Please note that the patch should be generated against trunk/wordpress-develop. Here is the GitHub mirror to clone wordpress-develop sources: https://github.com/WordPress/wordpress-develop :-)

Note: See TracTickets for help on using tickets.