Skip to content

Commit 4d178bd

Browse files
authored
Fixed server Closing on invalid $requestPort (#46726)
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.
1 parent 9588b4e commit 4d178bd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Illuminate/Foundation/Console/ServeCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,12 @@ protected function handleProcessOutput()
251251
$this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]);
252252
} elseif (str($line)->contains(' Closing')) {
253253
$requestPort = $this->getRequestPortFromLine($line);
254-
$request = $this->requestsPool[$requestPort];
255254

256-
[$startDate, $file] = $request;
255+
if (empty($this->requestsPool[$requestPort])) {
256+
return;
257+
}
258+
259+
[$startDate, $file] = $this->requestsPool[$requestPort];
257260

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

0 commit comments

Comments
 (0)