Laravel Version
11.30.0
PHP Version
8.3.13 64bit TS
Database Driver & Version
No response
Description
When logging with single-quoted ' strings that containing escape characters like \r and [ ], they are being interpreted in the log output. This results in unexpected behavior, such as \r being converted to a carriage return, even though single-quoted strings in PHP treat backslashes as literal characters.
Using Illuminate\Support\Facades\Log
With default logging configuration.
Steps To Reproduce
1- Download and create a Laravel 11 application project. (https://laravel.com/docs/11.x)
2- In any route, controller, or model file, log a string using single-quotes with a backslash \r and bracket [ ].
Example:
Log::info('[MyNamespace\routes\non-web\application]');
3- Check the Laravel log file.
Expected output
local.INFO: [MyNamespace\routes\non-web\application]
Actual output
local.INFO: [MyNamespace
outes
on-web\application]