-
Couldn't load subscription status.
- Fork 11.6k
[11.x] Fix: Improve Request Port Extraction Handling in ServeCommand.php to Prevent Artisan Command Failures #53538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.x] Fix: Improve Request Port Extraction Handling in ServeCommand.php to Prevent Artisan Command Failures #53538
Conversation
|
Can we extract this function into a static function that we then put a lot of tests around? |
Thanks a lot. Based on your suggestion, I moved the Hope this will solve the issue in a better approach. |
[Updated] This PR fixes an issue (#53534) in the
getRequestPortFromLinemethod inServeCommand.phpwhere failing to extract the request port from the log line resulted in anUndefined array key 1error when usingLOG_CHANNEL=stderr. This error would break the server when generating a URL with missing parameters, causing Artisan commands to fail.Changes:
How This Fix Solves the Issue:
This fix resolves the issue where the server breaks because the
getRequestPortFromLinemethod fails to parse log lines with a datetime prefix. By updating the regex, we ensure that both types of log lines (with and without datetime) are handled correctly. Additionally, the exception handling ensures that if parsing fails, it is immediately clear which log line caused the failure, facilitating quicker debugging for devs.This way, this PR enhances the stability of Laravel's
artisan servecommand by addressing the log parsing issue in a a manner which can ensure smoother development workflows. Thank you.