WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

#52369 closed defect (bug) (fixed)

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

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

Description

Currently the deprecated file uses

<?php
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 8 months ago.

Download all attachments as: .zip

Change History (6)

#1 @audrasjb
8 months 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
8 months 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.

@oellin
8 months ago

#3 follow-up: @oellin
8 months ago

  • Keywords has-patch added; needs-patch removed

Hi,

This is my first contribution.

In this patch i replaced require with require_once.

#4 in reply to: ↑ 3 @SergeyBiryukov
8 months ago

Replying to oellin:

This is my first contribution.

The patch looks great, thank you :)

#5 @SergeyBiryukov
8 months 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.