feat(lenovo): add broad 'Lenovo TB' prefix for modern tablets#1013
Merged
serbanghita merged 1 commit into4.8.xfrom Apr 17, 2026
Merged
feat(lenovo): add broad 'Lenovo TB' prefix for modern tablets#1013serbanghita merged 1 commit into4.8.xfrom
serbanghita merged 1 commit into4.8.xfrom
Conversation
Add 'Lenovo TB|' catch-all to the LenovoTablet regex to match all modern Lenovo tablets using the TB-XXXX and TBXXXFU naming formats. This replaces the need to individually list every new model code. Addresses PR #994 and related issues #871, #855 where newer Lenovo tablets were not detected because only specific model codes were listed. Add 5 test fixtures for recent models (TB330FU, TB370FU, TB351FU, TB321FU, TB311XU) that are only matched by the new broad prefix.
There was a problem hiding this comment.
Pull request overview
This PR expands Lenovo tablet detection by adding a broad Lenovo TB prefix to the LenovoTablet tablet-regex, so modern Lenovo tablet model strings (e.g., TB-XXXX and TB###FU) are classified as tablets without needing to enumerate every new model code.
Changes:
- Update
LenovoTabletdetection regex to include a broadLenovo TBprefix. - Add 5 new Lenovo tablet UA fixtures (TB330FU, TB370FU, TB351FU, TB321FU, TB311XU).
- Regenerate
tests/ualist.json(including its hash) to reflect the updated provider fixtures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/MobileDetect.php |
Adds Lenovo TB to the LenovoTablet detection pattern to cover newer Lenovo tablet UA formats. |
tests/providers/vendors/Lenovo.php |
Adds 5 new Lenovo tablet UA fixtures expected to be matched by the new broad prefix. |
tests/ualist.json |
Updates generated UA fixture list and hash to remain in sync with provider fixtures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
Author
|
I feel tiny bit of unconfortable to allow a broad regex like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lenovo TB|catch-all prefix to theLenovoTabletregex, matching all modern Lenovo tablets that useTB-XXXX(hyphenated) orTBXXXFU(non-hyphenated) naming formatsContext
Addresses PR #994 ("Add new 'Lenovo TB' user-agent" by @nstwfdev) and related issues #871, #855. Newer Lenovo tablets were not detected because the existing regex only matched
Lenovo TAB(old naming) or specific model codes. This change adds the missingLenovo TBbroad prefix while keeping all existing individual entries intact.Lenovo tablet naming conventions
Lenovo TAB ...Lenovo TAB 2 A7-30FLenovo TAB(existing)Lenovo TB-XXXXLenovo TB-J606FLenovo TBXXXFULenovo TB330FULenovo TB(new)False positive risk
Minimal — a UA containing
Lenovo TBis virtually always a Lenovo tablet. The prefix is always followed by either a hyphen+model code or a numeric model code.Test plan
src/MobileDetect.phpline 567