Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#47793 closed defect (bug) (fixed)

Incorrect filter documentation in is_email() function

Reported by: jenkoian's profile jenkoian Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.3
Component: Formatting Keywords: has-patch
Focuses: docs Cc:

Description

The docs for the is_email() filter are slightly incorrect:

		/**
		 * Filters whether an email address is valid.
		 *
		 * This filter is evaluated under several different contexts, such as 'email_too_short',
		 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
		 * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context.
		 *
		 * @since 2.8.0
		 *
		 * @param bool   $is_email Whether the email address has passed the is_email() checks. Default false.
		 * @param string $email    The email address being checked.
		 * @param string $context  Context under which the email was tested.
		 */

https://github.com/WordPress/WordPress/blob/c7493264a41addda75c05e49d65e8cc2bbbeaf44/wp-includes/formatting.php#L3279-L3291

Suggests that $is_email will always be a boolean, but as you can see from the following it could be a string:

return apply_filters( 'is_email', $email, $email, null );

https://github.com/WordPress/WordPress/blob/c7493264a41addda75c05e49d65e8cc2bbbeaf44/wp-includes/formatting.php#L3350

Attachments (1)

47793.patch (951 bytes) - added by jenkoian 5 years ago.

Download all attachments as: .zip

Change History (3)

@jenkoian
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#2 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45703:

Docs: Correct parameter type and description for is_email filter.

Props jenkoian.
Fixes #47793.

Note: See TracTickets for help on using tickets.