{"record":{"id":"5298a612821dacba","repo":"Seldaek/monolog","slug":"failed-to-preg-split-formatted-string-pcreerrorc","errorCode":null,"errorMessage":"Failed to preg_split formatted string: {pcreErrorCode} / {preg_last_error_msg}","messagePattern":"Failed to preg_split formatted string: (.+?) / (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/ErrorLogHandler.php","lineNumber":88,"sourceCode":"        return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%');\n    }\n\n    /**\n     * @inheritDoc\n     */\n    protected function write(LogRecord $record): void\n    {\n        if (!$this->expandNewlines) {\n            error_log((string) $record->formatted, $this->messageType);\n\n            return;\n        }\n\n        $lines = preg_split('{[\\r\\n]+}', (string) $record->formatted);\n        if ($lines === false) {\n            $pcreErrorCode = preg_last_error();\n\n            throw new \\RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / '. preg_last_error_msg());\n        }\n        foreach ($lines as $line) {\n            error_log($line, $this->messageType);\n        }\n    }\n}\n","sourceCodeStart":70,"sourceCodeEnd":95,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/ErrorLogHandler.php#L70-L95","documentation":"Error \"Failed to preg_split formatted string: {pcreErrorCode} / {preg_last_error_msg}\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/ErrorLogHandler.php:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}