Make WordPress Core

#63219 closed defect (bug) (fixed)

Minor Code Improvement: Adjust $mailserver_url Condition Order in wp-mail.php

Reported by: dilipbheda Owned by: SergeyBiryukov
Priority: normal Milestone: 6.9
Component: Mail Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Reordered the condition in the $mailserver_url check to prioritize the empty() check.

Reason for Change:

  • Improves readability and logic consistency by checking for an empty value first.
  • Prevents unnecessary string comparison if $mailserver_url is empty.

It follows a common best practice of checking for an empty value before doing a specific comparison.

Change History (3)

This ticket was mentioned in ​PR #8639 on ​WordPress/wordpress-develop by ​@dilipbheda.


19 months ago
#1

#2 @mukesh27
19 months ago

  • Milestone Awaiting Review → 6.9

Thanks for ticket and PR.

Move to 6.9

#3 @SergeyBiryukov
19 months ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 60122:

Coding Standards: Check for an empty mail server URL first in wp-mail.php.

This follows a common best practice of checking for an empty value before doing a specific comparison.

Follow-up to [39772].

Props dilipbheda, mukesh27.
Fixes #63219.

Note: See TracTickets for help on using tickets.