Problem/Motivation
Parameters in reverse order to implode() has been deprecated since PHP 7.4 and is removed since PHP 8.0.
FILE: sites/all/modules/contrib/field_group/field_group.module
1295 | 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 compatibility:
phpcs --standard=PHPCompatibility --runtime-set testVersion 7.4 contrib/field_group
Proposed resolution
Correct the order of the parameters.
Original report by rajeshwari10
This issue title and description has been updated to reflect the findings of the contributions in the comments below. The original posting, copied here for posterity, didn't account for existing fixes via #3085340.
PHPCS compatibility errors with PHP 7.2 and 7.4
Run Phpcs compatibility across field_group module. Will get the below warning.
ERROR : Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$bundle_name" was changed on line 113.
When testing with PHP 7.4, you also get:
sites/all/modules/contrib/field_group/field_group.module line 1294
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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | interdiff-1_5.txt | 863 bytes | divyesh19 |
| #5 | field_group-php-7.2-compatible-3083542-5.patch | 575 bytes | divyesh19 |
| #2 | field_group-php-7.2-compatible-3083542-1.patch | 548 bytes | rajeshwari10 |
Comments
Comment #2
rajeshwari10 commentedPlease find the below patch which will resolve this issue.
Comment #3
dwwWhen I run this check on the 7.x-1.x branch, I'm also getting:
Seems worth fixing both of these in the same issue for scope management, right? Fix all the potential PHP 7+ compatibility problems at once, instead of 7.2 vs. 7.4 separately? I'll defer to the maintainers, but I vote for fixing both in 1 issue.
Thanks,
-Derek
Comment #4
dwwComment #5
divyesh19As per latest php 7.4 compatibility check on 1.x-dev, we only have the below warning:
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 secondAttached updated patch for the same.
Comment #6
joelpittet@divyesh19 please merge both patches into one patch.
Comment #7
mrinalini9 commentedMerged both patches #2 and #5 into one patch, please review.
Comment #9
mrinalini9 commentedPlease ignore patch #7 and patch #5 will be the updated patch because patch #1 seems to be already present in branch 7.x-1.x.
Comment #10
tormiIndeed, duplicate of https://www.drupal.org/project/field_group/issues/3085340.
Comment #11
joelpittetMy apologies, I should have checked the dev branch, this is great, thanks for everybody's help on this. Please commit #5 the other change was already committed.
Comment #12
fadonascimento commentedI have been tested both patches under the php7.4 and both worked as expected.
Should it generate another module version with theses fixes?
Comment #13
jcandan commentedUpdated the issue description to make it clear that part of the original issue reported has already been fixed in a separate issue, and that the patch #5 appropriately addresses the single issue noted.
Comment #15
swentel commentedcommitted and pushed, thanks!
Comment #16
swentel commented