Seldaek/monolog · error · RuntimeException
Failed to preg_split formatted string: {pcreErrorCode} / {pr
Error message
Failed to preg_split formatted string: {pcreErrorCode} / {preg_last_error_msg} What it means
Error "Failed to preg_split formatted string: {pcreErrorCode} / {preg_last_error_msg}" thrown in Seldaek/monolog.
Source
Thrown at src/Monolog/Handler/ErrorLogHandler.php:88
return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%');
}
/**
* @inheritDoc
*/
protected function write(LogRecord $record): void
{
if (!$this->expandNewlines) {
error_log((string) $record->formatted, $this->messageType);
return;
}
$lines = preg_split('{[\r\n]+}', (string) $record->formatted);
if ($lines === false) {
$pcreErrorCode = preg_last_error();
throw new \RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / '. preg_last_error_msg());
}
foreach ($lines as $line) {
error_log($line, $this->messageType);
}
}
}
View on GitHub (pinned to 57eb102834)
When it happens
Trigger: Thrown at src/Monolog/Handler/ErrorLogHandler.php:88 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Seldaek/monolog@57eb102834 (2026-08-17).
Data as JSON: /api/errors/5298a612821dacba.
Report an issue: GitHub.