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 #44908

Conversation

christoph-kluge
Copy link
Contributor

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"
@christoph-kluge christoph-kluge changed the title [9.x] Fix php artisan serve´ with PHP_CLI_SERVER_WORKERS > 1` [9.x] Fix php artisan serve with PHP_CLI_SERVER_WORKERS > 1 Nov 11, 2022
@taylorotwell taylorotwell merged commit 103d38a into laravel:master Nov 11, 2022
christoph-kluge added a commit to christoph-kluge/framework that referenced this pull request Nov 21, 2022
…ry because it might include nested brackets. (laravel#44908)

"[13804] [Fri Nov 11 16:37:08 2022] [::1]" would resolve into "[Fri Nov 11 16:37:08 2022] [::1"
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