Skip to content

Commit

Permalink
strict prod mode enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
yapro committed Jun 17, 2024
1 parent bc5babc commit c99cd5c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Handler/JsonToStdErrHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,20 @@ public function write(array $record): void
} else {
$this->writeToStdErr($result);
}
exit(123);
exit(122);
};
$result = $this->getMessage($record);
if (sha1($result) === $this->lastRecordHash) {
return;
}
$this->lastRecordHash = sha1($result);
$this->writeToStdErr($result);
// По причине https://yapro.ru/article/16221 останавливаю обработку ошибок:
if (PHP_SAPI === 'fpm-fcgi' && isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] === 'prod') {
http_response_code(500);
echo 'Sorry, an unexpected error has occurred.';
exit(123);
}
}

public function writeToStdErr(string $message)
Expand Down

0 comments on commit c99cd5c

Please sign in to comment.