PHPMailer\PHPMailer

PHPMailer::isPermittedPathprotected 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.

Returns

true|false.

Usage

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

PHPMailer::isPermittedPath() code WP 6.9

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