From 9e3670e140579c8331779776125e88af68269ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Frei?= <37588173+freiondrej@users.noreply.github.com> Date: Wed, 1 Apr 2020 17:33:44 +0200 Subject: [PATCH] Check whether path is file in DataPart::fromPath() --- src/Symfony/Component/Mime/Part/DataPart.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Mime/Part/DataPart.php b/src/Symfony/Component/Mime/Part/DataPart.php index c6f1cb9742eff..17e3e3c0d38ef 100644 --- a/src/Symfony/Component/Mime/Part/DataPart.php +++ b/src/Symfony/Component/Mime/Part/DataPart.php @@ -56,6 +56,10 @@ public static function fromPath(string $path, string $name = null, string $conte $contentType = self::$mimeTypes->getMimeTypes($ext)[0] ?? 'application/octet-stream'; } + if (false === is_readable($path)) { + throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path)); + } + if (false === $handle = @fopen($path, 'r', false)) { throw new InvalidArgumentException(sprintf('Unable to open path "%s".', $path)); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy