Make WordPress Core


Ignore:
Timestamp:
06/12/2020 09:08:08 PM (4 years ago)
Author:
TimothyBlynJacobs
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-phpmailer.php

    r48033 r48034  
    44 * The PHPMailer class has been moved to the wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.
    55 */
    6 _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.' ) );
     6if ( function_exists( '_deprecated_file' ) ) {
     7    _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.' ) );
     8}
    79require __DIR__ . '/PHPMailer/PHPMailer.php';
    810
Note: See TracChangeset for help on using the changeset viewer.