I've been running into some problems upgrading my server from PHP7.3 to PHP8.0, so I figured I'd list what I've found and ask if anyone else has a better solution.
The Problem I'm running into: I've got a PHP Laminas application that uses the laminas/laminas-cache package in composer.json; the problem is that it has several dependancies that are NOT compatible with PHP8 (also, several of the dependencies are abandoned), so I get errors like this:
- laminas/laminas-cache-storage-adapter-apc[1.0.0, ..., 1.0.1] require php ^5.6 || ^7.0 -> your php version (8.0.9) does not satisfy that requirement.
- laminas/laminas-cache 2.13.0 requires laminas/laminas-cache-storage-adapter-apc ^1.0 -> satisfiable by laminas/laminas-cache-storage-adapter-apc[1.0.0, 1.0.1].
- Root composer.json requires laminas/laminas-cache ^2.13 -> satisfiable by laminas/laminas-cache[2.13.0].
It looks like laminas/laminas-cache 3.0 will solve a bunch of the dependency problems, but it's still in a Dev state, so it's considered too unstable for my production environment. Which means that I've got to use laminas/laminas-cache 2.13.
How to fix it: It took me a while to find this documentation, but as far as I can tell you're supposed to pick-and-choose which dependencies you want to ignore by putting them in a Replace section:
https://github.com/laminas/laminas-cache/issues/88
And here is the standard list of packages to "replace:"
"replace": {
"laminas/laminas-cache-storage-adapter-apc": "*",
"laminas/laminas-cache-storage-adapter-dba": "*",
"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": "*"
},
Once I've copy/pasted that section into composer.json it allows me to successfully run composer update
without it throwing a fit, but I'm not a huge fan of having a bunch of packages replaced with with "*" version wildcard.
So... my question is: Is there a better a way to do this, or have I stumbled onto the best solution until laminas/laminas-cache 3.0 is complete?