Closed sanchezzzhak closed 7 months ago
The version must be declared as a string
Problem 3 The UA Mozilla/5.0 (X11; Linux x86_64; rv:21.0) Gecko/20100101 SlimerJS/0.7 result Firefox for full parsing misc/test.php
If you use the Library parser, the result is client type "library"
# Firefox
- regex: '(?<!like )Gecko(?:/(?:\d+[\.\d]+) (?!SlimerJS))'
name: 'Firefox'
version: ''
engine:
default: 'Gecko'
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; Win64; x64; Anonymisiert durch AlMiSoft Browser-Maulkorb 39663422; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Tablet PC 2.0; Browzar)
If we use full parsing, we get the application, but if we use the Browser Parser separately, we get the browser.
@sanchezzzhak coincidence or not, I wanted to talk about this a few days ago. I use Spyc::YAMLDump
to generate the tests. Depending on version it escapes it or not in double quotes, I see there's a code in misc
folder to rewrite them, so technically all version
and engine_version
should be escaped in double quotes.
What should I do with platform:
for example. Should it be platform: ""
? Same for platform: x64
or platform: "x64"
. I want to fix them in the next days.
What I see, is empty strings should have double quotes, otherwise without double quotes (except versions).
wrap quotes only for numbers \d+ and float (\d.\d) (if we expect to get the correct result in tests.)
platform: x64
https://github.com/matomo-org/device-detector/blob/c9952fc4d31dd249d2bf7dc88ca9963c7a2739b7/Tests/Parser/Client/fixtures/library.yml#L621C1-L643C18
In some parsers, this is perceived as a float/number and not as a string
full fix