Skip to content

Commit

Permalink
Hotfix: PHP 7.4 compatibility
Browse files Browse the repository at this point in the history
Throw exception earlier if provided filename is a directory.
We except the filename to be mbox file.

Fixes laminas#7

Signed-off-by: Michał Bundyra <contact@webimpress.com>
  • Loading branch information
michalbundyra committed Mar 31, 2020
1 parent fea074d commit c1b09a5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Storage/Mbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ protected function openMboxFile($filename)
$this->close();
}

if (is_dir($filename)) {
throw new Exception\InvalidArgumentException('file is not a valid mbox file');
}

ErrorHandler::start();
$this->fh = fopen($filename, 'r');
$error = ErrorHandler::stop();
Expand Down

0 comments on commit c1b09a5

Please sign in to comment.