doctrine / DoctrineModule

Doctrine Module for Laminas
http://www.doctrine-project.org/projects/doctrine-module.html
MIT License
398 stars 270 forks source link

Cannot migrate to PHP 8 due to laminas-cache 2.7 dependency. #725

Closed tswcode closed 2 years ago

tswcode commented 3 years ago

I would like to work with PHP 8, but DoctrineModule is the last module in my project which depends on a not PHP 8 ready module, which is laminas-cache version 2.7.

Is there a timeline or dependency, when you will upgrade the code or raise the version in the composer.json?

visto9259 commented 3 years ago

I second that. LmcRbacMvc cannot updgrade to PHP8 because of this dependency

TomHAnderson commented 3 years ago

I haven't budgeted time to make the upgrade myself but I'm very willing to work with you if you'd like to contribute to this open-source project. I am aware of your problem thanks to your reporting here.

driehle commented 3 years ago

@tswcode @visto9259 The package laminas-cache itself is already PHP8 ready, at least for its core. It has, however, some storage adapters which will not receive any further updates (e.g. wincache, xcache, etc.). For BC compatibility, in the 2.x series of laminas-cache, all adapters are installed and, hence, it won't run under PHP8. To enable support for PHP8, you can simply supress the unneeded adapters in the composer.json of your project, as suggested here https://docs.laminas.dev/laminas-cache/installation/#avoid-unused-cache-adapters-are-being-installed. Once laminas-cache 3.x is released that won't be needed anymore.

This is what the composer.json of your application could look like:

    "require": {
         "doctrine/doctrine-module": "^4.1.2"
    },
    "replace": {
        "laminas/laminas-cache-storage-adapter-apc": "*",
        "laminas/laminas-cache-storage-adapter-dba": "*",
        "laminas/laminas-cache-storage-adapter-memcache": "*",
        "laminas/laminas-cache-storage-adapter-memcached": "*",
        "laminas/laminas-cache-storage-adapter-mongodb": "*",
        "laminas/laminas-cache-storage-adapter-wincache": "*",
        "laminas/laminas-cache-storage-adapter-xcache": "*",
        "laminas/laminas-cache-storage-adapter-zend-server": "*"
    }
driehle commented 3 years ago

@TomHAnderson May I suggest that we drop support for PHP 7.2 in favour of updating all involved dependencies? I have created a PR #727

tswcode commented 3 years ago

@driehle Thank you for this composer hint, now I can update the components to run on php 8.0. Should I close this issue in favor of #727 ?

visto9259 commented 3 years ago

@tswcode Keep it open. #727 does not resolve support for PHP8. This is a work around and not a real solution. This forces people to be aware that somewhere within doctrine-module, there is a dependency on laminas-cache that has dependencies on cache adapters that are no longer supported. I should not have to worry about dependencies n-level deep in my main composer.json.

driehle commented 3 years ago

Agreed, but that won't be able to solve until laminas-cache v3 is officially released. That still seems to be a bit of work according to https://github.com/laminas/laminas-cache/milestone/2, so I wouldn't expect this in the near future. Therefore, to me it seems most reasonable to add something to the README.md and in the release notes of the (potentially) upcoming 4.2.0 release, if Tom agrees to merge #727.

visto9259 commented 3 years ago

As a minimum, doctrine-module should upgrade its dependencies to laminas-cache v2. It's still on v1.

There are people at Laminas working on PHP8 versions of the v2 adapters already.

driehle commented 3 years ago

@visto9259 That is not true, see diff of #727. It upgrades laminas/laminas-cache from 2.7.1 to 2.11.2. You probably mixed it up with doctrine/cache, which is something different.

There are people at Laminas working on PHP8 versions of the v2 adapters already.

All adapters (exluding those which are abandonned) are already PHP8-compatible! However, for BC reasons all adapters are required by default in laminas-cache v2. That is why you (as an application developer, i.e. not the DoctrineModule maintainers) need to manually exclude the adapters you don't want to use. I agree that this is a bit cumbersome, but that's how the laminas-cache developers have decided to proceed.

visto9259 commented 3 years ago

You are right. I got confused. I take back my last comment.

driehle commented 2 years ago

DoctrineModule in any 4.x version can be used with PHP 8.0 or 8.1 and laminas-cache 2.x, when following the installation instructions on how to suppress the installation of unneeded cache adapters. This can be read in either our documentation or in the laminas-cache documentation.

Starting with DoctrineModule 4.3.0, laminas-cache 3.x is supported. With laminas-cache 3.x, users do not need to do anything anymore, the installation will run just smoothly.