Skip to content

Commit

Permalink
Fixed server Closing on invalid $requestPort (#46726)
Browse files Browse the repository at this point in the history
On a docker deploy I get a random `Undefined array key` when try to manage the `Closing` server response on a undefined `$requestPort`.

Maybe the problem is `getRequestPortFromLine` parse, but for now maybe the best option is check the `$this->requestsPool[$requestPort]` before continue with the output.
  • Loading branch information
eusonlito authored Apr 10, 2023
1 parent 9588b4e commit 4d178bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Illuminate/Foundation/Console/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,12 @@ protected function handleProcessOutput()
$this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]);
} elseif (str($line)->contains(' Closing')) {
$requestPort = $this->getRequestPortFromLine($line);
$request = $this->requestsPool[$requestPort];

[$startDate, $file] = $request;
if (empty($this->requestsPool[$requestPort])) {
return;
}

[$startDate, $file] = $this->requestsPool[$requestPort];

$formattedStartedAt = $startDate->format('Y-m-d H:i:s');

Expand Down

0 comments on commit 4d178bd

Please sign in to comment.