Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#52369 closed defect (bug) (fixed)

Deprecated wp-includes/SMTP.php should use require_once to include the new namespaced class

Reported by: greatsaltlake's profile greatsaltlake Owned by: audrasjb's profile audrasjb
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.5
Component: Mail Keywords: good-first-bug has-patch
Focuses: Cc:


Currently the deprecated file uses

require __DIR__ . '/PHPMailer/SMTP.php';

which can lead to a fatal error if that class or the deprecated file has already been loaded.

Attachments (1)

52369.diff (507 bytes) - added by oellin 3 years ago.

Download all attachments as: .zip

Change History (6)

#1 @audrasjb
3 years ago

  • Component changed from General to External Libraries
  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 5.7
  • Owner set to audrasjb
  • Status changed from new to accepted
  • Version changed from 5.6 to 5.5

Hi @greatsaltlake, welcome to WordPress Core Trac and thank you for opening this ticket.

The bug report makes sense to me.

Moving it to the current milestone (5.7) and adding the good-first-bug workflow keyword as this is a good ticket to onboard people for their very first contribution.

I'm unsure about moving this to External libraries component, though. @SergeyBiryukov as WP 5.7 Core Tech Lead, I’d rely on you for moving this to the best component if needed :)

#2 @SergeyBiryukov
3 years ago

  • Component changed from External Libraries to Mail

Good catch, introduced in [48033] / #41750.

This was solved for wp-includes/class-phpmailer.php in [48530] / #50716, but not for class-smtp.php.

Since wp-includes/class-smtp.php is no longer an external file, moving to the Mail component.

3 years ago

#3 follow-up: @oellin
3 years ago

  • Keywords has-patch added; needs-patch removed


This is my first contribution.

In this patch i replaced require with require_once.

#4 in reply to: ↑ 3 @SergeyBiryukov
3 years ago

Replying to oellin:

This is my first contribution.

The patch looks great, thank you :)

#5 @SergeyBiryukov
3 years ago

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

In 50022:

Mail: Make sure the SMTP class is only required once if a plugin requires wp-includes/class-smtp.php directly.

Follow-up to [48033], [48530].

Props oellin, greatsaltlake, audrasjb.
Fixes #52369. See #50716, #41750.

Note: See TracTickets for help on using tickets.