-2

I haven't dealt with Drupal before, but I needed to upgrade the server from Debian 10 with PHP 7.3 to Debian 12 with PHP 8.2. The website throws 500 errors.

I added debugging lines on the index.php file and I got these errors.

Deprecated: Return type of DrupalCacheArray::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/clients/web/includes/bootstrap.inc on line 362

Deprecated: Return type of DrupalCacheArray::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/clients/web/includes/bootstrap.inc on line 369

Deprecated: Return type of DrupalCacheArray::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/clients/web/includes/bootstrap.inc on line 381

Deprecated: Return type of DrupalCacheArray::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/clients/web/includes/bootstrap.inc on line 388

Fatal error: During inheritance of PDO: Uncaught ArgumentCountError: Too few arguments to function _drupal_error_handler(), 4 passed in /var/www/clients/web/includes/bootstrap.inc on line 2754 and exactly 5 expected in /var/www/clients/web/includes/bootstrap.inc:2601 Stack trace: #0 /var/www/clients/web/includes/bootstrap.inc(2754): _drupal_error_handler(8192, 'Return type of ...', '/var/www/client...', 1317) #1 /var/www/clients/web/includes/bootstrap.inc(2754): require_once() #2 /var/www/clients/web/includes/bootstrap.inc(2528): _drupal_bootstrap_database() #3 /var/www/clients/web/includes/bootstrap.inc(2673): drupal_bootstrap(3, false) #4 /var/www/clients/web/includes/bootstrap.inc(2524): _drupal_bootstrap_page_cache() #5 /var/www/clients/web/index.php(24): drupal_bootstrap(7) #6 {main} in /var/www/clients/web/includes/database/database.inc on line 0

How can I fix these errors?

I am using Drupal 7.73.

2 Answers 2

2

Drupal 7 is not fully compatible with PHP 8.2. See this issue. But if Drupal core will be compatible, a lot of legacy contrib modules don't work with PHP 8. You can try to use PHP 8.1

Before upgrade PHP version you need to upgrade Drupal core to the latest version (Today it is 7.98), because 7.73 is really old.

1
  • I will try to download drupal and making it working on local machine and update it, thank you Aug 21, 2023 at 11:57
1

Drupal 7 is not yet full compatible with PHP 8.2. [META] Make Drupal 7 core compatible with PHP 8.2, a meta issue created to follow that change, is not yet closed as fixed, although many of its child issues (the ones created for effectively changing the Drupal 7 code) are already closed as fixed.

Fixing the compatibility with PHP 8.2 on Drupal core could require some time. In some cases, the issue is on a contributed project, and they need to verify if the issue is caused by Drupal core (and fix Drupal core) or by a contributed project (and in this case, the time necessary to fix the issue depends from that project's maintainers, not from Drupal core maintainers).

PHP requirements for Drupal 7 shows that PHP 8.2 is supported starting from Drupal 7.94. Drupal 7.73 does not support PHP 8, but Drupal 7.4.

PHP version Supported by Drupal Recommended for Drupal 7?
7.4 Yes, as of Drupal 7.71 No
8.0 Yes, as of Drupal 7.79 Yes
8.1 Yes, as of Drupal 7.92 Yes
8.2 Yes, as of Drupal 7.94 Yes
8.3 No No

That is still what Drupal core supports. What supported by contributed project varies from project to project.

How can I fix these errors?

Assuming those errors are caused by Drupal core code, you just need to wait PHP 8.1 is fully supported by Drupal core. If those errors are caused by contributed modules, you need to wait those modules fully support PHP 8.1.

1
  • Hello, Thank you, I fixed the problem by manually update to Drupal 7.98, Just uploaded the new Drupal and replace folder "sites". Aug 30, 2023 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.