themetman's picture

Is it possible to use Drush 8 with php8 ?? I have been looking on this forum, GitHub and the internet, but cannot find how to do this.

I have a fresh install of Ubuntu Server 22.04 which defaults to php8 and I have Drush 8.4.8 install on it.

In my site using drush --version and php7.4 I get this:

Drush proper version: 8.4.8
Backdrop Drush Extension version: 1.x-1.x

but with php8.1 I get this:

Undefined array key 2 command.inc:1014                               [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
Undefined array key "description" command.inc:1304                                                                                                                                                                                              [warning]
PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens: SELECT name FROM {system} WHERE type='module' AND status=1; Array
(
    [:type] => module
    [:status] => 1
)
 in drush_db_select() (line 131 of phar:///usr/local/bin/drush/includes/dbtng.inc).
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                                              [error]
Error: Return type of DrushBatchContext::offsetSet($name, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the
notice in phar:///usr/local/bin/drush/includes/batch.inc, line 39

Is there some way to fix this?

Accepted answer

I think that is correct.  While Backdrop core has got this sorted, quite a few contrib modules could probably do with some help to get ready for 8.1.

It should also be considered that Drush 8 seems to be pegged to End of Life for D7, which at the moment is Nov 2023 but surely they will pull the plug on the life support at some time.  Will Drush still be an option for Backdrop once Drush 8 is no longer supported?

There is brush and bee.  Alan has said that they are no longer developing brush in favour of bee

bee is looking good, but could do with some help, particularly on the update function.

Most helpful answers

I just ran into this too, for those curious here's the relevant drush issue:
https://github.com/backdrop-contrib/backdrop-drush-extension/issues/254

For some reason I had not come across Bee or Brush, @yourshirepudding

I have had a look at the forum Post about Drush, Brush and Bee and then the  YouTube Video and then modified my scripts to use Bee which proved very easy indeed.

Many thanks to the folks who have created Bee.

Great Stuff!

========================== EDIT =====================

However I have now found that Bee does not Update Modules (this is in the Issues for adding) it only updates core and Brush does not Export and Import config as in bcim and cex from Bee or Drush, so to use PHP 8 I will have to use a combination of Brush and Bee to do my automated upgrades with Ansible.

Comments

I've seen this too. Something needs to be fixed for 8.1 but I haven't had the time to figure out what.

themetman's picture

Many thanks for the comment @herb

I should have added that php 7.4 only gets support until the end of November 2022, so we should be moving to version php 8.x inside the next 5 months or so.

Am I correct?

I think that is correct.  While Backdrop core has got this sorted, quite a few contrib modules could probably do with some help to get ready for 8.1.

It should also be considered that Drush 8 seems to be pegged to End of Life for D7, which at the moment is Nov 2023 but surely they will pull the plug on the life support at some time.  Will Drush still be an option for Backdrop once Drush 8 is no longer supported?

There is brush and bee.  Alan has said that they are no longer developing brush in favour of bee

bee is looking good, but could do with some help, particularly on the update function.

themetman's picture

For some reason I had not come across Bee or Brush, @yourshirepudding

I have had a look at the forum Post about Drush, Brush and Bee and then the  YouTube Video and then modified my scripts to use Bee which proved very easy indeed.

Many thanks to the folks who have created Bee.

Great Stuff!

========================== EDIT =====================

However I have now found that Bee does not Update Modules (this is in the Issues for adding) it only updates core and Brush does not Export and Import config as in bcim and cex from Bee or Drush, so to use PHP 8 I will have to use a combination of Brush and Bee to do my automated upgrades with Ansible.