Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
christoph-kluge:9.x-fix-artisan-serve-with-multiple-workers
Nov 21, 2022
Merged

[9.x] Fix php artisan serve with PHP_CLI_SERVER_WORKERS > 1#45041
taylorotwell merged 1 commit into
laravel:9.xfrom
christoph-kluge:9.x-fix-artisan-serve-with-multiple-workers

Conversation

@christoph-kluge

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

Copy link
Copy Markdown
Contributor

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.

2 participants