Skip to content

Commit 5fdd95f

Browse files
committed
Avoid overwrite last ip or user_agent with empty ones
tlaverdure/laravel-echo-server#546 In some cases request doesn'nt has `ipAddress` or `userAgent`, with this change it avoid overwrite the last reported data
1 parent dcda06f commit 5fdd95f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Illuminate/Session/DatabaseSessionHandler.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ protected function performInsert($sessionId, $payload)
174174
*/
175175
protected function performUpdate($sessionId, $payload)
176176
{
177+
if ($this->container->bound('request')) {
178+
if (! $payload['ip_address']) {
179+
unset($payload['ip_address']);
180+
}
181+
if (! $payload['user_agent']) {
182+
unset($payload['user_agent']);
183+
}
184+
}
185+
177186
return $this->getQuery()->where('id', $sessionId)->update($payload);
178187
}
179188

0 commit comments

Comments
 (0)