Skip to content

fix: detect Safari version from Version token#10251

Open
memleakd wants to merge 1 commit into
codeigniter4:developfrom
memleakd:fix/safari-user-agent-version
Open

fix: detect Safari version from Version token#10251
memleakd wants to merge 1 commit into
codeigniter4:developfrom
memleakd:fix/safari-user-agent-version

Conversation

@memleakd
Copy link
Copy Markdown
Contributor

Description

This PR fixes Safari version detection in the UserAgent parser. Safari user agents commonly include both a Version/... token and a Safari/... token:

Version/16.3 Safari/605.1.15

The Safari/... token is not the user-facing Safari browser version. The actual browser version is reported by Version/....

Previously, CodeIgniter identified the browser as Safari but returned the Safari/... value as the version. That could make browser-version checks behave incorrectly, e.g. treating Safari 16.3 as newer than 16.4 because it was reported as 605.1.15.

This keeps Safari detection unchanged, but when Safari is matched it uses the Version/... token for getVersion() if present.

Tests cover desktop Safari, mobile Safari, and Chrome user agents that also contain a Safari/... token.

Fixes #10250

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: UserAgent reports Safari WebKit version instead of browser version

3 participants