PHPMailer\PHPMailer

PHPMailer::isPermittedPath()protected staticWP 1.0

Check whether a file path is of a permitted type. Used to reject URLs and phar files from functions that access local file paths, such as addAttachment.

Method of the class: PHPMailer{}

No Hooks.

Return

true|false.

Usage

$result = PHPMailer::isPermittedPath( $path );
$path(string) (required)
A relative or absolute path to a file

PHPMailer::isPermittedPath() code WP 6.5.2

protected static function isPermittedPath($path)
{
    //Matches scheme definition from https://tools.ietf.org/html/rfc3986#section-3.1
    return !preg_match('#^[a-z][a-z\d+.-]*://#i', $path);
}