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.0 + 8.1 errors #254

Closed
herbdool opened this issue May 24, 2022 · 7 comments
Closed

PHP 8.0 + 8.1 errors #254

herbdool opened this issue May 24, 2022 · 7 comments

Comments

@herbdool
Copy link

When trying drush --version I get these errors. They might be related or unrelated errors:

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).

and..

Undefined array key 2 command.inc:1014                               [warning]
Undefined array key "description" command.inc:1304

and...

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
@herbdool
Copy link
Author

The last error might be Lando not using the latest Drush 8 release by default. https://github.com/drush-ops/drush/releases/tag/8.4.10. Not sure but when I manually set it up with that version I don't see the last error message.

@laryn
Copy link
Member

laryn commented Dec 12, 2022

I see there's a PR related to some PHP 8.x issues here (including an error message you reference above). And I'm seeing this if I use PHP 8.0 on Lando (but not if I revert down to PHP 7.4):

PHP Fatal error:  Uncaught Error: Class "Drupal\Core\Logger\RfcLogLevel"

@herbdool In regard to your last comment about the latest Drush 8 version, my testing is with 8.4.12-dev and I also don't see the last error message you mentioned.

@jenlampton
Copy link
Member

jenlampton commented Jan 20, 2023

I see this error a Drupal 7 site on PHP 8.0:

drush --version

Undefined array key 4 command.inc:1018                               [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Drush proper version: 8.4.9
Backdrop Drush Extension version: 1.x-1.x

I see this error a Backdrop site on PHP 8.0:

drush --version

Undefined array key 4 command.inc:1018                               [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]
Undefined array key "description" command.inc:1308                                                                         [warning]

Fatal error: Uncaught Error: Class "Drupal\Core\Logger\RfcLogLevel" not found in drush-8/commands/core/drupal/environment_common.inc:294
Stack trace:
#0 drush-8/includes/drupal.inc(122): drush_watchdog_severity_levels()
#1 backdrop/docroot/core/includes/module.inc(975): system_watchdog(Array)
#2 backdrop/docroot/core/includes/bootstrap.inc(2345): module_invoke_all('watchdog', Array)
#3 backdrop/docroot/core/includes/errors.inc(214): watchdog('php', '%type: !message...', Array, 3)
#4 backdrop/docroot/core/includes/bootstrap.inc(2979): _backdrop_log_error(Array, true)
#5 [internal function]: _backdrop_exception_handler(Object(PDOException))
#6 {main}
  thrown in drush-8/commands/core/drupal/environment_common.inc on line 294
Drush command terminated abnormally due to an unrecoverable error.                                                         [error]
Error: Uncaught Error: Class "Drupal\Core\Logger\RfcLogLevel" not found in
drush-8/commands/core/drupal/environment_common.inc:294
Stack trace:
#0 drush-8/includes/drupal.inc(122): drush_watchdog_severity_levels()
#1 backdrop/docroot/core/includes/module.inc(975): system_watchdog(Array)
#2 backdrop/docroot/core/includes/bootstrap.inc(2345): module_invoke_all('watchdog',
Array)
#3 backdrop/docroot/core/includes/errors.inc(214): watchdog('php', '%type: !message...',
Array, 3)
#4 backdrop/docroot/core/includes/bootstrap.inc(2979): _backdrop_log_error(Array, true)
#5 [internal function]: _backdrop_exception_handler(Object(PDOException))
#6 {main}
  thrown in drush-8/commands/core/drupal/environment_common.inc, line 294

I suspect using the latest version of drush

@klonos
Copy link
Member

klonos commented Jun 5, 2023

I confirm the problem with php 8.0 using lando v3.18.0 on Mac. My lando config looks like this:

recipe: backdrop
config:
  webroot: docroot
  database: mariadb
  php: '8.0'
  drush: '8.4.12'
  backdrush: 1.x-1.x
  # Installs the latest 2.x version of composer instead of the default 2.x.
  composer_version: 2

If I don't specify composer_version: 2, I get an outdated version:

lando composer --version
Composer version 2.2.18 2022-08-20 11:33:38

...whereas explicitly specifying it, I get this:

lando composer --version
Composer version 2.5.7 2023-05-24 15:00:39

And the reason why I was fiddling with that is that I've been getting this error when trying to revert to PHP 7.4:

lando drush version
PHP Fatal error:  Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.33. in /var/www/.composer/vendor/composer/platform_check.php on line 24

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.33. in /var/www/.composer/vendor/composer/platform_check.php on line 24

Also noting that I have to use drush: '8.4.12' to explicitly set the drush version, as drush: ^8 doesn't seem to work for me (but that's probably a lando issue more than an issue with the backdrop-drush-extension).

@klonos
Copy link
Member

klonos commented Jun 5, 2023

...I'm also seeing this:

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /var/www/.composer/vendor/drush/drush/includes/command.inc on line 777

Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/.composer/vendor/drush/drush/includes/command.inc on line 777
ERROR ==> Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/.composer/vendor/drush/drush/includes/command.inc on line 777

@izmeez
Copy link

izmeez commented Oct 11, 2023

I noticed fatal errors with Drush 8.4.12 and php 8.1.17 so I reverted to Drush 8.4.11 where it just has deprecated warnings. Not that it really matters since Bee seems to be a better choice, unless there is something specific that drush provides?

@quicksketch
Copy link
Member

Fixed by #251 and #264.

There's definitely some deeper underlying issue with Drush 8 and Backdrop's extension. I'd encourage everyone to move over to https://github.com/backdrop-contrib/bee, which will continue to be supported after Drush 8's EOL.

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

No branches or pull requests

6 participants