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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user