heroku / heroku-buildpack-php

Heroku's buildpack for PHP applications.

Home Page:https://devcenter.heroku.com/categories/php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v208/209 is breaking my site by giving "provide"'s priority over the extension itself

boboldehampsink opened this issue · comments

Somewhere in my composer.lock is a provide ext-mbstring, and now it won't install the ext-mbstring extension anymore... and my sites need this extension (not the provide). Even requiring ext-mbstring in my composer.json doesn't fix this.

Can't roll back to using v207 either, it says

-----> Installing platform packages...
 !     ERROR: Failed to install system packages!
 !     
 !     Your platform requirements (for runtimes and extensions) could
 !     not be resolved to an installable set of dependencies, or a
 !     platform package repository was unreachable.
 !     
 !     This usually means that you (or packages you are using) depend
 !     on a combination of PHP versions and/or extensions that are
 !     currently not available on Heroku.
 !     
 !     The following is the full output from the installation attempt:
 !     
 !     > No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
 !     > Loading repositories with available runtimes and extensions
 !     > Updating dependencies
 !     > Your requirements could not be resolved to an installable set of packages.
 !     > 
 !     >   Problem 1
 !     >     - php 8.0.15 requires heroku/installer-plugin ^1.6.0 -> found heroku/installer-plugin[1.5.0] but it does not match the constraint.
 !     >     - composer.json/composer.lock requires php 8.0.15 -> satisfiable by php[8.0.15].
 !     > 
 !     > Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
 !     
 !     For reference, the following runtimes are currently available:
 !     
 !     PHP:  8.1.2, 8.1.1, 8.1.0, 8.0.15, 8.0.14, 8.0.13, 8.0.12, 
 !     8.0.11, 8.0.10, 8.0.9, 8.0.8, 8.0.7, 8.0.6, 8.0.3, 8.0.2, 
 !     8.0.1, 8.0.0, 8.0.0RC4, 7.4.27, 7.4.26, 7.4.25, 7.4.24, 
 !     7.4.23, 7.4.22, 7.4.21, 7.4.20, 7.4.19, 7.4.16, 7.4.15, 
 !     7.4.14, 7.4.13, 7.4.12, 7.3.33, 7.3.32, 7.3.31, 7.3.30, 
 !     7.3.29, 7.3.28, 7.3.27, 7.3.26, 7.3.25, 7.3.24
 !     
 !     Please verify that all requirements for runtime versions in
 !     'composer.lock' are compatible with the list above, and ensure
 !     all required extensions are available for the desired runtimes.
 !     
 !     When choosing a PHP runtimes and extensions, please also ensure
 !     they are available on your app's stack (heroku-20), and select
 !     a different stack if needed after consulting the article below.
 !     
 !     For a list of supported runtimes & extensions on Heroku, please
 !     refer to: https://devcenter.heroku.com/articles/php-support
 !     Push rejected, failed to compile PHP app.
 !     Push failed

See #539 (comment)

Can you try with buildpack branch composer2installer, please?

@dzuelke that works. But does it favor provide'd ext over native ext's now? I have not explictly required ext-mbstring, if I do would it override the provide (which i have not explicitly required either).

Yes, it does for the initial platform install step; everything is now completely consistent with the normal Composer dependency resolution order - if a userland package provides ext-mbstring, then Composer will not install the "native" ext-mbstring, because the dependency is already satisfied.

This has always been the case for third-party extensions (e.g. it would happen with the symfony/polyfill-uuid package before), and the behavior is now unified for internal extensions.

Obviously, this can lead to problems like in this ticket, which is why that change you tested is about to be rolled out - what it does is attempt to forcefully install the native extension variant after main dependency solving has concluded.

A native extension will not always be installable; for instance, if you had a (hypothetical, but we use it in our tests) polyfill for ext-xmlrpc (and a dependency on that ext), and a PHP requirement of *, you'd get PHP 8.1 (PHP 8 no longer has ext-xmlrpc) and the ext-xmlrpc polyfill.

The buildpack's attempt to install the "real" ext-xmlrpc would then not downgrade PHP to 7.4, even if your requirements permitted that, because the initial solving results remain locked, and packages can only be added - you don't want a downgrade to PHP 7.4, that's why you're using that ext-xmlrpc polyfill!

Ok thanks for the explanation. So to use native extensions over provide's by dependencies I will always have to explicitly require them in my main composer file?

I just ran into the same issue and am not entirely sure - was it specifically caused by my composer.json requiring ext-pdo_sqlite (which is not included by default according to the docs?

Reading the commits, am I correct that this branch/fix will be merged into 210? Forcing this branch seems to be working for me in the meantime.

Ok thanks for the explanation. So to use native extensions over provide's by dependencies I will always have to explicitly require them in my main composer file?

Yes. If you think about it, that makes sense - if nothing really requires ext-mbstring, it should also not get installed, right?

In practice, though, things that need ext-mbstring in frameworks do declare it as a require - it doesn't have to be in your composer.json root. All packages' dependencies are taken into account by the solver.

I just ran into the same issue and am not entirely sure - was it specifically caused by my composer.json requiring ext-pdo_sqlite (which is not included by default according to the docs?

Reading the commits, am I correct that this branch/fix will be merged into 210? Forcing this branch seems to be working for me in the meantime.

Interesting; what makes you think it was ext-pdo_sqlite? Can you share build output from the broken and the successful runs? Or what error message(s) did you get?

Sorry I just assumed as this issue mentioned the ext... dependencies. I was seeing the following (to be clear I am using dokku):

remote: -----> Bootstrapping...
remote: -----> Installing platform packages...
remote:
remote:  !     ERROR: Failed to install system packages!
remote:  !
remote:  !     Your platform requirements (for runtimes and extensions) could
remote:  !     not be resolved to an installable set of dependencies, or a
remote:  !     platform package repository was unreachable.
remote:  !
remote:  !     This usually means that you (or packages you are using) depend
remote:  !     on a combination of PHP versions and/or extensions that are
remote:  !     currently not available on Heroku.
remote:  !
remote:  !     The following is the full output from the installation attempt:
remote:  !
remote:  !     > Loading repositories with available runtimes and extensions
remote:  !     > Updating dependencies
remote:  !     > Your requirements could not be resolved to an installable set of packages.
remote:  !     >
remote:  !     >   Problem 1
remote:  !     >     - php 7.4.27 requires heroku/installer-plugin ^1.6.0 -> no matching package found.
remote:  !     >     - php 8.0.15 requires heroku/installer-plugin ^1.6.0 -> no matching package found.
remote:  !     >     - php 8.1.2 requires heroku/installer-plugin ^1.6.0 -> no matching package found.
remote:  !     >     - symfony/polyfill-ctype v1.24.0 requires php >=7.1 -> satisfiable by php[7.1.33, 7.2.26, 7.2.27, 7.2.28, 7.2.29, 7.2.30, 7.2.31, 7.2.32, 7.2.33, 7.2.34, 7.3.13, 7.3.14, 7.3.15, 7.3.16, 7.3.17, 7.3.18, 7.3.19, 7.3.20, 7.3.21, 7.3.22, 7.3.23, 7.3.24, 7.3.25, 7.3.26, 7.3.27, 7.3.28, 7.3.29, 7.3.30, 7.3.31, 7.3.32, 7.3.33, 7.4.10, 7.4.11, 7.4.12, 7.4.13, 7.4.14, 7.4.15, 7.4.16, 7.4.19, 7.4.2, 7.4.20, 7.4.21, 7.4.22, 7.4.23, 7.4.24, 7.4.25, 7.4.26, 7.4.27, 7.4.3, 7.4.4, 7.4.5, 7.4.6, 7.4.7, 7.4.8, 7.4.9, 8.0.0, 8.0.1, 8.0.10, 8.0.11, 8.0.12, 8.0.13, 8.0.14, 8.0.15, 8.0.2, 8.0.3, 8.0.6, 8.0.7, 8.0.8, 8.0.9, 8.1.0, 8.1.1, 8.1.2].
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.1.0
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.1.1
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.1.33
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.26
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.27
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.28
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.29
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.30
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.31
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.32
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.33
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.2.34
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.13
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.14
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.15
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.16
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.17
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.18
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.19
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.20
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.21
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.22
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.23
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.24
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.25
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.26
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.27
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.28
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.29
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.30
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.31
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.32
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.3.33
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.10
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.11
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.12
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.13
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.14
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.15
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.16
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.19
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.2
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.20
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.21
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.22
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.23
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.24
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.25
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.26
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.3
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.4
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.5
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.6
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.7
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.8
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 7.4.9
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.0
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.1
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.10
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.11
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.12
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.13
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.14
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.2
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.3
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.6
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.7
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.8
remote:  !     >     - don't install symfony/polyfill-ctype v1.24.0|don't install php 8.0.9
remote:  !     >     - Installation request for symfony/polyfill-ctype v1.24.0 -> satisfiable by symfony/polyfill-ctype[v1.24.0].
remote:  !     >
remote:  !
remote:  !     For reference, the following runtimes are currently available:
remote:  !
remote:  !     PHP:  8.1.2, 8.1.1, 8.1.0, 8.0.15, 8.0.14, 8.0.13, 8.0.12,
remote:  !     8.0.11, 8.0.10, 8.0.9, 8.0.8, 8.0.7, 8.0.6, 8.0.3, 8.0.2,
remote:  !     8.0.1, 8.0.0, 7.4.27, 7.4.26, 7.4.25, 7.4.24, 7.4.23,
remote:  !     7.4.22, 7.4.21, 7.4.20, 7.4.19, 7.4.16, 7.4.15, 7.4.14,
remote:  !     7.4.13, 7.4.12, 7.4.11, 7.4.10, 7.4.9, 7.4.8, 7.4.7,
remote:  !     7.4.6, 7.4.5, 7.4.4, 7.4.3, 7.4.2, 7.3.33, 7.3.32,
remote:  !     7.3.31, 7.3.30, 7.3.29, 7.3.28, 7.3.27, 7.3.26, 7.3.25,
remote:  !     7.3.24, 7.3.23, 7.3.22, 7.3.21, 7.3.20, 7.3.19, 7.3.18,
remote:  !     7.3.17, 7.3.16, 7.3.15, 7.3.14, 7.3.13, 7.2.34, 7.2.33,
remote:  !     7.2.32, 7.2.31, 7.2.30, 7.2.29, 7.2.28, 7.2.27, 7.2.26,
remote:  !     7.1.33
remote:  !     HHVM:
remote:  !
remote:  !     Please verify that all requirements for runtime versions in
remote:  !     'composer.lock' are compatible with the list above, and ensure
remote:  !     all required extensions are available for the desired runtimes.
remote:  !
remote:  !     When choosing a PHP runtimes and extensions, please also ensure
remote:  !     they are available on your app's stack (heroku-18), and select
remote:  !     a different stack if needed after consulting the article below.
remote:  !
remote:  !     Be advised that the heroku-18 stack you're currently using only
remote:  !     supports PHP version 7.1 and later.
remote:  !
remote:  !     For a list of supported runtimes & extensions on Heroku, please
remote:  !     refer to: https://devcenter.heroku.com/articles/php-support
remote:

Ah yeah, well, Dokku isn't up to date (they bundle snapshots of this buildpack).

Fixed and released (#541) to the official stable buildpack channel.

@boboldehampsink, @alancwoo and everyone else, you can now revert your workarounds.

Thank you for your patience and enjoy your weekend!

Fixed and released (#541) to the official stable buildpack channel.

@boboldehampsink, @alancwoo and everyone else, you can now revert your workarounds.

Thank you for your patience and enjoy your weekend!

@dzuelke thank you so much for the quick updates, we really appreciate your help, especially as a dokku user I understand we can be a bit of a thorn in your side!

@dzuelke I'm really sorry to say but this issue cropped up again in the latest buildpack, locking to v211 allowed me to deploy again, but just wanted to let you know.

That's... surprising, since none of the logic changed after v210 (did you mean locking to v221 maybe?).

Anyway, can you please make a reproduce case, @alancwoo ? I think just uploading your composer.json and composer.lock would be enough (maybe you can trim down the list of packages, too).

That would be really helpful so I can investigate and implement a fix.

@alancwoo can you provide details please?