Sentry-php: Ocramius/PackageVersions dropped PHP 7.2.0 support

Created on 17 Jul 2019  路  24Comments  路  Source: getsentry/sentry-php

Hello,

One of your dependencies has just updated, it drops PHP 7.2.0 support
See the commit here .

My cloud build runs into the following issues related to the commit above:

I 2019-07-17T07:25:45.664234296Z Step #1:   Problem 1 
I 2019-07-17T07:25:45.664236221Z Step #1:     - Installation request for ocramius/package-versions 1.5.0 -> satisfiable by ocramius/package-versions[1.5.0]. 
I 2019-07-17T07:25:45.664239713Z Step #1:     - ocramius/package-versions 1.5.0 requires php ^7.3.0 -> your PHP version (7.2.17) does not satisfy that requirement. 
I 2019-07-17T07:25:45.664240341Z Step #1:   Problem 2 
I 2019-07-17T07:25:45.664241179Z Step #1:     - ocramius/package-versions 1.5.0 requires php ^7.3.0 -> your PHP version (7.2.17) does not satisfy that requirement. 
I 2019-07-17T07:25:45.664242166Z Step #1:     - jean85/pretty-package-versions 1.2 requires ocramius/package-versions ^1.2.0 -> satisfiable by ocramius/package-versions[1.5.0]. 
I 2019-07-17T07:25:45.664242904Z Step #1:     - Installation request for jean85/pretty-package-versions 1.2 -> satisfiable by jean85/pretty-package-versions[1.2]. 

I am using Google App Engine, it's not yet support PHP version 7.3, find out more here.

Is there any solution to pass through this case?
Thank you very much.

Invalid Question

Most helpful comment

Just add "ocramius/package-versions": "<1.5" to your composer.json to force the 1.4 version, it will _probably (depending on your other dependencies)_ make the issue go away for now.

Please DO NOT do this! composer update already takes care of upper constraints if your system is not compatible. If you are running on PHP 7.3 in your dev environment, and on older PHP versions in production, then use this block:

{
    "config": {
        "platform": {"php": "7.2.0"}
    }
}

See docs at https://getcomposer.org/doc/06-config.md#platform
See docs at https://www.doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html

The CORRECT way to approach this is to remove the difference between development and production environment: it will only hurt you long-term, because you are effectively testing in production.

All 24 comments

Given that I do not understand why stop supporting PHP 7.2 which will be supported at least until November (/cc @Ocramius), I cannot reproduce the issue. I just tried installing the sentry/sdk and it worked fine by downloading ocramius/package-versions 1.4.0. If you could post your composer.json it may be helpful

You can pinpoint to ocramius/packages-versions:^1.

Besides that, I regularly bump all dependencies of my libraries regularly, and will keep doing so.

@ste93cry
Sentry sdk is using dependence jean85/pretty-package-versions. This dependence uses "ocramius/package-versions": "^1.2.0" (https://github.com/Jean85/pretty-package-versions/blob/master/composer.json).
Since ocramius/package-versions:1.5.0 requires php 7.3, sentry sdk and jean85/pretty-package-versions don't work well.

ocramius/package-versions:^1.2 includes a range of releases. It does work well, even with 7.0: https://github.com/Ocramius/PackageVersions/blob/1.2.0/composer.json#L13

A normal composer update will pick the latest release suitable for your environment.

@ste93cry
This is our composer.json

{
    "require": {
        "sentry/sdk": "2.0.3"
    }
}

After removed sentry/sdk, our app worked well.

Should work with a composer update then: it would probably install 1.4.x.

Consider that I released 1.5.0 just earlier today.

Besides that, I regularly bump all dependencies of my libraries regularly, and will keep doing so.

Yea I agree that this is a good practice and I didn't meant you should stop doing it, but of course one thing it to to update the vendors and another is to update the minimum programming language version. By the way,you already said everything: there is nothing that should force picking version 1.5.0 so I think that the problem is somewhere else in the composer.json and without seeing it fully it's rather difficult to know what's wrong

PHP is a dependency like any other 馃槈

@vukhanhtruong the issue is probably in your local dev environment: you're probably using 7.3 locally and you've run composer update there, where 1.5 is allowed. That is not true for your prod env, so you need to align the two, or at the very least force the PHP version in your composer.json (which I do NOT reccomend).

Thank you guys for kindly support. The solution is we have to define specific PHP version to the composer JSON file.

I've just encountered this issue with sentry/sentry-laravel as my Homestead environment was defaulting to PHP 7.3.4-1 but the production server is on 7.2. The easiest solution to the problem was to delete the composer.lock where the package had been updated and re-install everything with a 7.2 environment set for composer via php7.2 /usr/local/bin/composer install. I hope this helps anyone encountering this issue.

As I said before, I discourage using this workarounds, because they are just tricks. You should always have the same runtime in dev as in prod to avoid those issues.

@Jean85++

@Jean85 totally agree with you but at the moment that DevOps infrastructure isn't there right now and is possibly not there for some others. It's something that should be changing for us in the near future, but for the time being this temporary workaround does work.

Just add "ocramius/package-versions": "<1.5" to your composer.json to force the 1.4 version, it will _probably (depending on your other dependencies)_ make the issue go away for now.

Also, make sure to remove that constraint if either the package re-introduces support for PHP 7.2, or, your environment gets updated to PHP 7.3.

See the answer below.

Just add "ocramius/package-versions": "<1.5" to your composer.json to force the 1.4 version, it will _probably (depending on your other dependencies)_ make the issue go away for now.

Please DO NOT do this! composer update already takes care of upper constraints if your system is not compatible. If you are running on PHP 7.3 in your dev environment, and on older PHP versions in production, then use this block:

{
    "config": {
        "platform": {"php": "7.2.0"}
    }
}

See docs at https://getcomposer.org/doc/06-config.md#platform
See docs at https://www.doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html

The CORRECT way to approach this is to remove the difference between development and production environment: it will only hurt you long-term, because you are effectively testing in production.

Totally agree with @Ocramius.

@Jean85 totally agree with you but at the moment that DevOps infrastructure isn't there right now and is possibly not there for some others. It's something that should be changing for us in the near future, but for the time being this temporary workaround does work.

You don't need "devops" for this. You just need to fix your local dev env and make it to use at least the same minor (same patch is better) of PHP as in prod.

Otherwise the composer workaround is a faster fix, but still a workaround, not a proper solution.

I would like to suggest that version 1.5 should have been version 2.0 according to semantic versioning rules, as it broke backward compatibility.

Fair enough. Statement retracted

Im also running on PHP 7.2.
to fix issue, simply run:

composer update

See result -->

Screenshot_35

Hello everyone, this is more a question than an issue.

My environment is PHP 7.3 on my development server but my app also runs on PHP 7.2.
I have a Travis CI build that fails on PHP 7.2 (see https://travis-ci.org/geo6/manager/jobs/624120872):

  Problem 1
    - Installation request for ocramius/package-versions 1.5.1 -> satisfiable by ocramius/package-versions[1.5.1].
    - ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.2.15) does not satisfy that requirement.

Indeed, my composer.lock file register ocramius/package-versions version 1.5.1 since I'm on PHP 7.3 but even though I run composer install --no-interaction --no-dev for the build it still fails.

Any idea on how to properly make that work ? Am I doing something wrong ?
Or should I just "drop" support for PHP 7.2 ?

Thanks a lot !

@jbelien if you want to support PHP 7.2, then use ocramius/package-versions:^1.4.2, which still has "php": "^7.1" as constraint.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anka-213 picture anka-213  路  6Comments

mitchhentges picture mitchhentges  路  3Comments

Quetzacoalt91 picture Quetzacoalt91  路  4Comments

codepuncher picture codepuncher  路  6Comments

iluuu1994 picture iluuu1994  路  7Comments