Skip to content

Commit c725219

Browse files
Merge branch '5.4' into 6.4
* 5.4: [DependencyInjection] Fix computing error messages involving service locators [Serializer] Fix unknown types normalization type when know type [ErrorHandler] Fix parsing messages that contain anonymous classes on PHP >= 8.3.3 [Validator] Review Romanian (ro) translations [Console] Fix display of Table on Windows OS [FrameworkBundle] Fix config builder with extensions extended in `build()` [WebProfilerBundle] disable turbo in web profiler toolbar to avoid link prefetching explicitly cast boolean SSL stream options return the unchanged text if preg_replace_callback() fails the 'use_notify' option is on the factory, not on the postgres connection class review translations
2 parents 3c36010 + 90b1d77 commit c725219

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

DebugClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ private function fixReturnStatements(\ReflectionMethod $method, string $returnTy
11331133
$braces = 0;
11341134
for (; $i < $end; ++$i) {
11351135
if (!$inClosure) {
1136-
$inClosure = str_contains($code[$i], 'function (');
1136+
$inClosure = false !== strpos($code[$i], 'function (');
11371137
}
11381138

11391139
if ($inClosure) {

ErrorHandler.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,23 +432,27 @@ public function handleError(int $type, string $message, string $file, int $line)
432432
return true;
433433
}
434434
} else {
435-
if (str_contains($message, '@anonymous')) {
435+
if (PHP_VERSION_ID < 80303 && str_contains($message, '@anonymous')) {
436436
$backtrace = debug_backtrace(false, 5);
437437

438438
for ($i = 1; isset($backtrace[$i]); ++$i) {
439439
if (isset($backtrace[$i]['function'], $backtrace[$i]['args'][0])
440440
&& ('trigger_error' === $backtrace[$i]['function'] || 'user_error' === $backtrace[$i]['function'])
441441
) {
442442
if ($backtrace[$i]['args'][0] !== $message) {
443-
$message = $this->parseAnonymousClass($backtrace[$i]['args'][0]);
444-
$logMessage = $this->levels[$type].': '.$message;
443+
$message = $backtrace[$i]['args'][0];
445444
}
446445

447446
break;
448447
}
449448
}
450449
}
451450

451+
if (false !== strpos($message, "@anonymous\0")) {
452+
$message = $this->parseAnonymousClass($message);
453+
$logMessage = $this->levels[$type].': '.$message;
454+
}
455+
452456
$errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line);
453457

454458
if ($throw || $this->tracedErrors & $type) {

ErrorRenderer/HtmlErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private function fixCodeMarkup(string $line): string
301301

302302
private function formatFileFromText(string $text): string
303303
{
304-
return preg_replace_callback('/in ("|&quot;)?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', fn ($match) => 'in '.$this->formatFile($match[2], $match[3]), $text);
304+
return preg_replace_callback('/in ("|&quot;)?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', fn ($match) => 'in '.$this->formatFile($match[2], $match[3]), $text) ?? $text;
305305
}
306306

307307
private function formatLogMessage(string $message, array $context): string

0 commit comments

Comments
 (0)