WhichBrowser / Parser-PHP

Browser sniffing gone too far — A useragent parser library for PHP
http://whichbrowser.net
MIT License
1.79k stars 242 forks source link

Incompatible with PSR/Cache ^2 #659

Closed mangelsnc closed 2 years ago

mangelsnc commented 3 years ago

Hi!

If you try to install this package in a Symfony 5.x environment with Doctrine 2.9, you get the next error:

Problem 1
    - Root composer.json requires whichbrowser/parser v2.1.2 -> satisfiable by whichbrowser/parser[v2.1.2].
    - whichbrowser/parser v2.1.2 requires psr/cache ^1.0 -> found psr/cache[1.0.0, 1.0.1] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

I think it can be solved by downgrading the version of psr/cache, but I think it would be better to make this library compatible with it.

This is the exit of composer why psr/cache:

$ composer why psr/cache
doctrine/annotations     1.13.1   requires   psr/cache (^1 || ^2 || ^3)
doctrine/cache           2.0.3    conflicts  psr/cache (>=3)
doctrine/orm             2.9.2    requires   psr/cache (^1 || ^2 || ^3)
doctrine/persistence     2.2.1    requires   psr/cache (^1.0|^2.0|^3.0)
symfony/cache            v5.2.10  requires   psr/cache (^1.0|^2.0)
symfony/cache-contracts  v2.4.0   requires   psr/cache (^1.0|^2.0|^3.0)

It seems like all the dependencies of psr/cache will work with version ^1, but I think it would be better to upgrade the dependency of this library.

therealsamsquanch commented 2 years ago

Pull request #665 adds compatibility with psr/cache v2 and v3. Unfortunately, it is still waiting for approval.

@NielsLeenheer can you please check the pull-requests awaiting approval?

rogeriolino commented 2 years ago

for while, to solve it, you can use the fork branch in your project:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/javer/Parser-PHP"
        }
    ],
    "require": {
        "whichbrowser/parser": "dev-psr-cache"
    }
}
NielsLeenheer commented 2 years ago

Thanks. Included in v2.1.3.