Skip to content

[4.x] Fix Browser Sessions not showing platform and browser#1412

Merged
taylorotwell merged 4 commits intolaravel:4.xfrom
olumby:agent-cache
Nov 29, 2023
Merged

[4.x] Fix Browser Sessions not showing platform and browser#1412
taylorotwell merged 4 commits intolaravel:4.xfrom
olumby:agent-cache

Conversation

@olumby
Copy link
Contributor

@olumby olumby commented Nov 29, 2023

Browser Sessions are currently showing '1-1' when they should be displaying 'Platform - Browser', the image below shows reality/expected behaviour.

browser sessions

#1399 used the cache implemented in mobiledetect/mobiledetectlib which only supports bool values. As multiple calls to agent->platform() and agent->browser() are made in the component the cache is engaged and produces boolean values instead of the expected strings.

This pull request replaces the mobiledetect cache implementation with a simple key value store on the Agent class.

Current tests pass as the first call to agent->platform() and agent->browser() do not hit the cache. Hopefully I will have time tomorrow to update the tests too.

I am not sure if this is the ideal solution or if the mobiledetect cache should be reimplemented to support mixed values. I briefly considered using the Laravel cache, but considering this data is only stored for the request lifecycle it seemed a little over the top.

@crynobone

This comment was marked as outdated.

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
@olumby
Copy link
Contributor Author

olumby commented Nov 29, 2023

nice, thanks for sorting out the tests 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants