Code Monkey home page Code Monkey logo

Comments (4)

ThaDafinser avatar ThaDafinser commented on June 18, 2024

This seems to be a real problem which i not covered until yet.

After checking the two UA you provided, following providers are affected by this two examples

  • DonatjUAParser
  • SingergiBrowserDetector
  • PiwikDeviceDetector
  • WhichBrowser
  • YzalisUAParser

Major/minor/patch are numbers, which i want to keep clean with numbers only. The question is if their are real version numbers which are not numeric?
E.g. alpha, beta, RC, ...?? Or dates are sometimes also used as versioning? We need here some examples.

Reason is simple: Mixing is always bad, so comparisons like $os->getVersion()->getMajor() >= 7 wont work correctly anymore.

But OS nicknames are nice, so we should support them.

We may could/should also show it in the complete string. Or we split it to multiple methods.
$version->getNumberComplete(); // only numeric version with . (i dont like the method name yet)
$version->getComplete() // nickname with numeric version?

class Version{

    // number
    private $major;
    // number
    private $minor;
    // number
    private $patch;

    // numeric with . seperator
    private $completeNumeric

     // string e.g. XP
    private $alias;

    // string e.g. XP 5.1 | or only numeric?
    private $complete;


    // maybe a stability flag?
    private $stability;

}

Other things to keep in mind, if we do it in this kind of way

  • support stability flag (beta, rc, alpha,...)
  • ..?

from useragentparser.

ThaDafinser avatar ThaDafinser commented on June 18, 2024

Beta example:

Mozilla/5.0 (X11; U; Linux i686; xx; rv:1.9b5) Gecko/2008052519 CentOS/3.0b5-0.beta5.6.el5.centos Firefox/3.0b5

Alpha example:

Mozilla/5.0 (Android 4.3.1; rv:6.0) Gecko/20100101 Firefox/26.0prealpha

from useragentparser.

NielsLeenheer avatar NielsLeenheer commented on June 18, 2024

WhichBrowser can provide the version in two ways:

  • A string that is meant to be displayed on screen
  • A string that is contains a version number - same specificity as the UA but reformatted

Sometimes the display string contains a prefix and the version number. Sometimes just an alias. And sometimes just the major version.

For example:

  • On OS X: "Yosemite 10.10" and "10.10"
  • On Windows: "XP" and "5.1"
  • And for Chrome: "30" and "30.0.1599.17"

from useragentparser.

ThaDafinser avatar ThaDafinser commented on June 18, 2024

This should be fixed now with PR #38

  • complete is always used as is
  • the hydration of major/minor/patch/alias was refactored that it should cover most cases
    • major/minor/patch is still number only
    • alias is populated when there is something else than number provided and not alpha/beta/...

from useragentparser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.