Skip to content

Commit 9e3670e

Browse files
freiondrejfabpot
authored andcommitted
Check whether path is file in DataPart::fromPath()
1 parent a9ffbf4 commit 9e3670e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Mime/Part/DataPart.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public static function fromPath(string $path, string $name = null, string $conte
5656
$contentType = self::$mimeTypes->getMimeTypes($ext)[0] ?? 'application/octet-stream';
5757
}
5858

59+
if (false === is_readable($path)) {
60+
throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path));
61+
}
62+
5963
if (false === $handle = @fopen($path, 'r', false)) {
6064
throw new InvalidArgumentException(sprintf('Unable to open path "%s".', $path));
6165
}

0 commit comments

Comments
 (0)
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