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

PHP 8.2 compatibility #5168

Closed
andypost opened this issue Jun 22, 2022 · 12 comments
Closed

PHP 8.2 compatibility #5168

andypost opened this issue Jun 22, 2022 · 12 comments

Comments

@andypost
Copy link
Contributor

andypost commented Jun 22, 2022

Upcoming release https://wiki.php.net/todo/php82 already started to publish releases

There's few incompatibilities detected so let's collect them under this issue

On July 21 first beta will be published but some changes already could be caught

PS core's issue is https://www.drupal.org/project/drupal/issues/3283358

@andypost
Copy link
Contributor Author

andypost commented Jun 22, 2022

There's already fixed webmozarts/assert@af18046

EDIT this dependency needs upgrade to 1.11.0

@weitzman
Copy link
Member

weitzman commented Jul 3, 2022

I think this is done.

@weitzman weitzman closed this as completed Jul 3, 2022
@danshumaker
Copy link

danshumaker commented Jun 1, 2023

I'm getting this error for version 11.5.1

docker@cli:/var/www$ drush --version
Drush Launcher Version: 0.10.1
PHP Deprecated:  Use of "static" in callables is deprecated in phar:///usr/local/bin/drush/vendor/webmozart/assert/src/Assert.php on line 1973

Deprecated: Use of "static" in callables is deprecated in phar:///usr/local/bin/drush/vendor/webmozart/assert/src/Assert.php on line 1973
PHP Deprecated:  Use of "static" in callables is deprecated in phar:///usr/local/bin/drush/vendor/webmozart/assert/src/Assert.php on line 1973

Deprecated: Use of "static" in callables is deprecated in phar:///usr/local/bin/drush/vendor/webmozart/assert/src/Assert.php on line 1973
Drush Commandline Tool 11.5.1

docker@cli:/var/www$ php --version
PHP 8.2.3 (cli) (built: Mar  1 2023 08:20:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.3, Copyright (c), by Zend Technologies
    with blackfire v1.86.4~linux-x64-non_zts82, https://blackfire.io, by Blackfire

So it's fixed but not released? Do I downgrade to get the upgrade? I'm not sure why the versions go from 11.5.1 (latest) to 8.4.12 and then to 12..

drush 2023-06-01 18-06-33

@greg-1-anderson
Copy link
Member

Drush 8 is the legacy version of Drush, for Drupal 7 support. Drush 8 and Drush 12 support PHP 8.2; looks like Drush 11 does not. You could try one of the RC releases of Drush 12. Drush 12 stable should be released pretty soon.

@danshumaker
Copy link

Thank you @greg-1-anderson . I see that when I try 12.0.0-rc4 it does seem to use webmozart/assert version 1.11.0 as mentioned above. However I get these errors after the upgrade:

docker@cli:/var/www$ vendor/bin/drush --version
PHP Fatal error:  Uncaught TypeError: Cannot assign bool to property Drush\Config\Environment::$docPrefix of type ?string in /var/www/vendor/drush/drush/src/Config/Environment.php:290
Stack trace:
#0 /var/www/vendor/drush/drush/src/Config/Environment.php(141): Drush\Config\Environment->docsPath()
#1 /var/www/vendor/drush/drush/src/Config/ConfigLocator.php(200): Drush\Config\Environment->exportConfigData()
#2 /var/www/vendor/drush/drush/src/Preflight/Preflight.php(183): Drush\Config\ConfigLocator->addEnvironment(Object(Drush\Config\Environment))
#3 /var/www/vendor/drush/drush/src/Preflight/Preflight.php(253): Drush\Preflight\Preflight->prepareConfig(Object(Drush\Config\Environment))
#4 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(58): Drush\Preflight\Preflight->preflight(Array)
#5 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#7 /var/www/vendor/drush/drush/drush(4): require('/var/www/vendor...')
#8 /var/www/vendor/bin/drush(119): include('/var/www/vendor...')
#9 {main}
  thrown in /var/www/vendor/drush/drush/src/Config/Environment.php on line 290

Fatal error: Uncaught TypeError: Cannot assign bool to property Drush\Config\Environment::$docPrefix of type ?string in /var/www/vendor/drush/drush/src/Config/Environment.php:290
Stack trace:
#0 /var/www/vendor/drush/drush/src/Config/Environment.php(141): Drush\Config\Environment->docsPath()
#1 /var/www/vendor/drush/drush/src/Config/ConfigLocator.php(200): Drush\Config\Environment->exportConfigData()
#2 /var/www/vendor/drush/drush/src/Preflight/Preflight.php(183): Drush\Config\ConfigLocator->addEnvironment(Object(Drush\Config\Environment))
#3 /var/www/vendor/drush/drush/src/Preflight/Preflight.php(253): Drush\Preflight\Preflight->prepareConfig(Object(Drush\Config\Environment))
#4 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(58): Drush\Preflight\Preflight->preflight(Array)
#5 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#7 /var/www/vendor/drush/drush/drush(4): require('/var/www/vendor...')
#8 /var/www/vendor/bin/drush(119): include('/var/www/vendor...')
#9 {main}
  thrown in /var/www/vendor/drush/drush/src/Config/Environment.php on line 290
docker@cli:/var/www$ php --version

Monosnap tmux 2023-06-05 10-19-14

Any ideas or suggestions?

@andypost
Copy link
Contributor Author

andypost commented Jun 5, 2023

can;t reproduce

/var/www/html/web $ vendor/bin/drush --version
Drush Commandline Tool 12.0.0.0
/var/www/html/web $ vendor/bin/drush version
Drush version : 12.0.0.0 
/var/www/html/web $ php -v
PHP 8.2.6 (cli) (built: May 10 2023 09:01:24) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.6, Copyright (c), by Zend Technologies

@danshumaker
Copy link

@andypost Can you start with drush version 11.5.1 , then do a composer update to get version 12 and then run those commands? That's my context. Is there a different upgrade step than a composer install drush/drush:^12 ? I tried restarting the container but that didn't seem to help.

@andypost
Copy link
Contributor Author

andypost commented Jun 6, 2023

@danshumaker yes, both works for me but use composer req drush/drush ^12.0

@gitressa
Copy link
Contributor

gitressa commented Jun 6, 2023

Something also blocked me from upgrading to version 12. So I tried removing and re-installing Drush, which worked well. Drush blocks Composer updates in some situations, where the trick is to remove it temporarily.

@danshumaker
Copy link

Cool works now. thx.

@danshumaker
Copy link

danshumaker commented Jun 7, 2023

@greg-1-anderson @andypost Just fyi this might end up causing more problems. We performed the composer update in our repo and when it was deployed to Acquia the container got the drush errors mentioned above.

2023-06-07T13:12:35Z 
2023-06-07T13:12:35Z Fatal error: Uncaught TypeError: Cannot assign bool to property Drush\Config\Environment::$docPrefix of type ?string in /var/www/html/vendor/drush/drush/src/Config/Environment.php:290
2023-06-07T13:12:35Z Stack trace:
2023-06-07T13:12:35Z #0 /var/www/html/vendor/drush/drush/src/Config/Environment.php(141): Drush\Config\Environment->docsPath()
2023-06-07T13:12:35Z #1 /var/www/html/vendor/drush/drush/src/Config/ConfigLocator.php(200): Drush\Config\Environment->exportConfigData()
2023-06-07T13:12:35Z #2 /var/www/html/vendor/drush/drush/src/Preflight/Preflight.php(183): Drush\Config\ConfigLocator->addEnvironment()
2023-06-07T13:12:35Z #3 /var/www/html/vendor/drush/drush/src/Preflight/Preflight.php(253): Drush\Preflight\Preflight->prepareConfig()
2023-06-07T13:12:35Z #4 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(58): Drush\Preflight\Preflight->preflight()
2023-06-07T13:12:35Z #5 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
2023-06-07T13:12:35Z #6 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
2023-06-07T13:12:35Z #7 /var/www/html/vendor/drush/drush/drush(4): require('...')
2023-06-07T13:12:35Z #8 /var/www/html/vendor/bin/drush(120): include('...')
2023-06-07T13:12:35Z #9 {main}
2023-06-07T13:12:35Z   thrown in /var/www/html/vendor/drush/drush/src/Config/Environment.php on line 290

Any suggestions on a fix?

@mohammadzo
Copy link

I can replicate this:
Drupal 10.2.x and PHP 8.2 and Latest version of Drush 12.4.3.0 .

$ drush --version 
Drush Launcher Version: 0.10.1

Deprecated: Use of "static" in callables is deprecated in phar:///usr/local/bin/drush/vendor/webmozart/assert/src/Assert.php on line 1973

Deprecated: Use of "static" in callables is deprecated in phar:///usr/local/bin/drush/vendor/webmozart/assert/src/Assert.php on line 1973
Drush Commandline Tool 12.4.3.0

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

No branches or pull requests

6 participants