Skip to content
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

[9.x] Fix php artisan serve with PHP_CLI_SERVER_WORKERS > 1 #45041

Conversation

christoph-kluge
Copy link
Contributor

@christoph-kluge christoph-kluge commented Nov 21, 2022

Notice

I created the same PR 2 weeks ago and missed to set the target branch to 9.x. It was merged to master in #44908.

Now correctly requesting the merge into 9.x.

Previous description

I checked it against php 8.0 and php 8.1 with laravel 9.32 and in both scenarios I receive an InvalidFormatException.

It turned out that (.*) seems to catch nested brackets. This PR restricts the allowed characters.

References #44204

 $line = '[13804] [Fri Nov 11 16:37:08 2022] [::1]:64202 Accepted'; 

- preg_match('/^\[\d+]\s\[(.*)]/', $line, $matches);
+ preg_match('/^\[\d+]\s\[([a-zA-Z0-9: ]+)]/', $line, $matches);

 var_dump($matches);
 array(2) {
   [0]=>
   string(40) "[13804] [Fri Nov 11 16:37:08 2022] [::1]"
   [1]=>
-  string(30) "Fri Nov 11 16:37:08 2022] [::1"
+  string(24) "Fri Nov 11 16:37:08 2022"
 }

…ry because it might include nested brackets.

"[13804] [Fri Nov 11 16:37:08 2022] [::1]" would resolve into "[Fri Nov 11 16:37:08 2022] [::1"
@taylorotwell taylorotwell merged commit 7392f1b into laravel:9.x Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants