Skip to content

Commit b4027a0

Browse files
janbarasekdg
authored andcommitted
use FileSystem::read() instead of native file_get_contents() (#69)
1 parent e61b0ef commit b4027a0

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/Bridges/MailDI/MailExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function loadConfiguration()
5454

5555
if ($this->config['dkim']) {
5656
$dkim = $this->config['dkim'];
57-
$dkim['privateKey'] = file_get_contents($dkim['privateKey']);
57+
$dkim['privateKey'] = Nette\Utils\FileSystem::read($dkim['privateKey']);
5858
unset($this->config['dkim']);
5959

6060
$signer = $builder->addDefinition($this->prefix('signer'))

src/Mail/Message.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,7 @@ private function createAttachment(string $file, ?string $content, ?string $conte
297297
{
298298
$part = new MimePart;
299299
if ($content === null) {
300-
$content = @file_get_contents($file); // @ is escalated to exception
301-
if ($content === false) {
302-
throw new Nette\FileNotFoundException("Unable to read file '$file'.");
303-
}
300+
$content = Nette\Utils\FileSystem::read($file);
304301
}
305302
if (!$contentType) {
306303
$contentType = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content);

0 commit comments

Comments
 (0)