From eddef0565cf1bd5c28949e694e72a021da2b7e15 Mon Sep 17 00:00:00 2001 From: Timothy Jacobs Date: Fri, 12 Jun 2020 21:08:08 +0000 Subject: [PATCH] External Libraries: Skip deprecated file warning for PHPMailer if the API is not loaded. In [48033] the "class-phpmailer.php" file was deprecated. In test suites, this file is loaded before WordPress in order to setup a mock PHPMailer instance. This means that for test suites that are still loading that file, they'll experience fatal errors due to the undefined "_deprecated_file" function. This commit skips issuing the deprecated file warning if the "_deprecated_file" function is not available. Fixes #50380. git-svn-id: https://develop.svn.wordpress.org/trunk@48034 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-phpmailer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-phpmailer.php b/src/wp-includes/class-phpmailer.php index b82f7ff613..796bd379f3 100644 --- a/src/wp-includes/class-phpmailer.php +++ b/src/wp-includes/class-phpmailer.php @@ -3,7 +3,9 @@ /** * The PHPMailer class has been moved to the wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace. */ -_deprecated_file( basename( __FILE__ ), '5.5.0', WPINC . '/PHPMailer/PHPMailer.php', __( 'The PHPMailer class has been moved to wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.' ) ); +if ( function_exists( '_deprecated_file' ) ) { + _deprecated_file( basename( __FILE__ ), '5.5.0', WPINC . '/PHPMailer/PHPMailer.php', __( 'The PHPMailer class has been moved to wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.' ) ); +} require __DIR__ . '/PHPMailer/PHPMailer.php'; class_alias( PHPMailer\PHPMailer\PHPMailer::class, 'PHPMailer' );