Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Application/ServerApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ public function addClient(Protocol\LivereloadProtocol $client)

public function removeClient(Protocol\LivereloadProtocol $client)
{
$this->clients = array_values(array_filter($this->clients, function($client) {
return !empty($client->app) && !empty($client->conn);
}));

$index = array_search($client, $this->clients, true);
if($index == false){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $client is the first element of $this->clients (means $this->clients[0]), the result of $index is 0.
Using strong type compare ($index === false) is better.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, that seems to be the cause all along. I've seen you have updated the master branch with this change, and everything seems to just run smoothly. Thanks!

return;
}

unset($this->clients[$index]);
}

Expand Down