Skip to content

Commit

Permalink
Truncate user_agent to fit session database column
Browse files Browse the repository at this point in the history
We only store it for debugging / visibility, this was previously
happening automatically due to mysql non-strict behaviour but
we now need to do it manually to avoid a strict mode error.
  • Loading branch information
acoulton committed Oct 17, 2023
1 parent 3181bec commit c0fa5ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### Unreleased

* Fix bug where devices with long user agents generated a database exception when attempting to create a session.

### v1.19.2 (2023-04-27)

* Add assertCapturedOneExactTimer helper. Allowing you to simultaneously assert only
Expand Down
2 changes: 1 addition & 1 deletion src/Session/MysqlSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function create_sid(): string
'hash' => $this->calculateHash(),
'data' => '',
'now' => \date('Y-m-d H:i:s'),
'user_agent' => $this->client_user_agent,
'user_agent' => mb_substr($this->client_user_agent, 0, 255),
'ip' => $this->client_ip,
]
);
Expand Down

0 comments on commit c0fa5ab

Please sign in to comment.