Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cachetool breaks PHP 7.4 Compatibility #2836

Closed
sprankhub opened this issue Dec 14, 2021 · 6 comments · Fixed by #2837
Closed

cachetool breaks PHP 7.4 Compatibility #2836

sprankhub opened this issue Dec 14, 2021 · 6 comments · Fixed by #2837

Comments

@sprankhub
Copy link
Contributor

  • Deployer version: v7.0.0-beta.24
  • Deployment OS: Ubuntu 20.04

If you add the following to your deploy.php and try to deploy a PHP 7.4 project, you will get an error.

  after('deploy:symlink', 'cachetool:clear:opcache');

The error looks like this:

[my.host.com] run if [ -f /my/path/releases/55/cachetool.phar ]; then echo +right; fi
[my.host.com] run cd /my/path/releases/55 && curl -sLO https://github.com/gordalina/cachetool/releases/latest/download/cachetool.phar
[my.host.com] run cd /my/path/releases/55 && /usr/bin/php7.4 /my/path/releases/55/cachetool.phar opcache:reset --fcgi=/var/run/my-socket.sock
[my.host.com] Composer detected issues in your platform:
[my.host.com] Your Composer dependencies require a PHP version ">= 8.0.0". You are running 7.4.26.
[my.host.com] PHP Fatal error:  Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0". You are running 7.4.26. in phar:///my/path/releases/55/cachetool.phar/vendor/composer/platform_check.php on line 24
[my.host.com]  error  in cachetool.php on line 80:
[my.host.com] exit code 255 (Unknown error)

The issue is that the cachetool is always used in the latest version:

run("cd {{release_or_current_path}} && curl -sLO https://github.com/gordalina/cachetool/releases/latest/download/cachetool.phar");

Unfortunately, the latest version dropped support for PHP 7, see https://github.com/gordalina/cachetool#compatibility.

I could not find any official information which PHP versions Deployer officially supports, but I think it should at least support all still maintained PHP versions (even if that PHP version only gets security fixes). So my suggested fix for now would be to fix the cachetool to version 7 and not use the latest version. Happy to send a PR.

What do you think?

@sprankhub
Copy link
Contributor Author

Well, according to

"php": "^8.0|^7.3",
, PHP 7.3 / 7.4 should be supported, so we should really fix this :)

@Schrank
Copy link
Contributor

Schrank commented Dec 14, 2021

@sprankhub Can you send a PR please? I'm happy to merge a pinned version.

And a cherry on the cake would be if you add a configuration to set the version/url :-)

@sprankhub
Copy link
Contributor Author

@Schrank, thanks for the fast answer. Please review the linked PR. And sorry, not time for a configuration option at the moment 🙈

Schrank added a commit that referenced this issue Dec 14, 2021
* Fix cachetool PHP 7 compatibility, fixes #2836
* Update cachetool.php

Create configuration option to change cachetool version

* Update doc

Co-authored-by: Fabian Blechschmidt <github@fabian-blechschmidt.de>
Co-authored-by: Fabian Blechschmidt <blechschmidt@fabian-blechschmidt.de>
@gordalina
Copy link
Contributor

🙏

@jamieburchell
Copy link
Contributor

Historically this seems to have been handled by checking the PHP version (https://github.com/deployphp/recipes/blob/master/recipe/cachetool.php#L13) but I suppose moving forward having to keep track of and updating this is not really viable.

@Schrank
Copy link
Contributor

Schrank commented Dec 15, 2021

I think it makes sense for the current braking changes. And if it times in the future, we add new versions again 🤷

So feel free to send another PR :D @jamieburchell

Thanks for coming up with the historical data <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants