PHP 7.4/8.0 compatibility

Created on 4 January 2022, almost 3 years ago
Updated 30 August 2023, about 1 year ago

Problem/Motivation

Uses deprecated version of implode() function. PHPCS returns the following errors:

FILE: ...es/all/modules/developer/missing_module/missing_module.drush.inc
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 106 | ERROR | Passing the $glue and $pieces parameters in reverse
     |       | order to implode has been deprecated since PHP 7.4 and
     |       | is removed since PHP 8.0; $glue should be the first
     |       | parameter and $pieces the second
----------------------------------------------------------------------


FILE: ...ites/all/modules/developer/missing_module/missing_module.install
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 53 | ERROR | Passing the $glue and $pieces parameters in reverse
    |       | order to implode has been deprecated since PHP 7.4 and
    |       | is removed since PHP 8.0; $glue should be the first
    |       | parameter and $pieces the second
----------------------------------------------------------------------

Steps to reproduce

Run PHPCS to check the code:

phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 8.0

Proposed resolution

Update implode function by switching the position of the parameters.

Original report by mikohl

Problem/Motivation

Drush command uses deprecated version of implode() function. PHPCS returns the following error:

FILE: ...cts/t4a/public-site/sites/all/modules/contrib/missing_module/missing_module.drush.inc
-------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------
 106 | WARNING | Passing the $glue and $pieces parameters in reverse order to implode has
     |         | been deprecated since PHP 7.4; $glue should be the first parameter and
     |         | $pieces the second
-------------------------------------------------------------------------------------------

Run PHPCS to check the code:

phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 7.4

Proposed resolution

Update implode function and switch the position of the parameters.

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mikohl

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

  • PHP 7.4

    The issue particularly affects sites running on PHP version 7.4.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024