1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-18 23:26:20 +02:00

Fixes php8 non-backward compatible changes (#1568)

* Utils method added to resolve PCRE error messages properly
This commit is contained in:
Juan Morales
2021-07-23 09:16:39 +02:00
committed by GitHub
parent d08c09d955
commit 82ab6a5f4f
6 changed files with 63 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ namespace Monolog\Handler;
use Monolog\Formatter\LineFormatter;
use Monolog\Formatter\FormatterInterface;
use Monolog\Logger;
use Monolog\Utils;
/**
* Stores to PHP error_log() handler.
@@ -80,7 +81,8 @@ class ErrorLogHandler extends AbstractProcessingHandler
$lines = preg_split('{[\r\n]+}', (string) $record['formatted']);
if ($lines === false) {
throw new \RuntimeException('Failed to preg_split formatted string: '.preg_last_error().' / '.preg_last_error_msg());
$pcreErrorCode = preg_last_error();
throw new \RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / '. Utils::pcreLastErrorMessage($pcreErrorCode));
}
foreach ($lines as $line) {
error_log($line, $this->messageType);