-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Errors from clamav when scanning files now throw FileScanException or…
… \RuntimeException if the response could not be parsed. Fixed reading response from socket so any errors are caught.
- Loading branch information
Showing
8 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Sineflow\ClamAV\Exception; | ||
|
||
class FileScanException extends \RuntimeException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $fileName; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $errorMessage; | ||
|
||
/** | ||
* @param string $fileName | ||
* @param string $errorMessage | ||
*/ | ||
public function __construct(string $fileName, string $errorMessage) | ||
{ | ||
$this->fileName = $fileName; | ||
$this->errorMessage = $errorMessage; | ||
$message = sprintf('Error scanning "%s": %s', $fileName, $errorMessage); | ||
|
||
parent::__construct($message); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getFileName(): string | ||
{ | ||
return $this->fileName; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getErrorMessage(): string | ||
{ | ||
return $this->errorMessage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Permissions for this file will be set to 000 in the beginning of the test, to make sure it's inaccessible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters