Skip to content

Commit

Permalink
Merge pull request #1 from iZucken/master
Browse files Browse the repository at this point in the history
Замалчивание ошибок yes
  • Loading branch information
Nikita Zarubin authored Jun 19, 2020
2 parents ff47922 + 91757c6 commit 5b0b924
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CryptoProCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ public static function verifyFileContent($fileContent)
}
}

private static function getDevNull()
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return 'NUL';
}
return '/dev/null';
}

/**
* Проверить, что файл подписан правильной подписью
*
Expand All @@ -112,8 +120,7 @@ public static function verifyFileContent($fileContent)
*/
public static function verifyFile($file)
{
$shellCommand = 'yes "n" | ' . self::getCryptcpExec() .
' -verify -verall ' . $file;
$shellCommand = 'yes "n" 2> '.self::getDevNull().' | ' . escapeshellarg(self::$cryptcpExec) . ' -verify -verall ' . escapeshellarg($file);
$result = shell_exec($shellCommand);
if (strpos($result, "[ErrorCode: 0x00000000]") === false && strpos($result, "[ReturnCode: 0]") === false) {
//Проверка неуспешна
Expand Down

0 comments on commit 5b0b924

Please sign in to comment.