Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#8367 closed defect (bug) (fixed)

PHP8: implode() no longer accepts deprecated order of args

Reported by: dd32's profile dd32 Owned by: imath's profile imath
Milestone: 6.4.0 Priority: high
Severity: normal Version:
Component: Core Keywords: has-patch
Cc:

Description

As of PHP8 (Scheduled for Nov 26th), implode( $glue, $pieces ) only accepts args in that order, it no longer supports passing the glue as the second arg.

BuddyPress has a singular case of using the deprecated syntax.

See attached patch.

This was found using the PHPCompatibility PHPCS ruleset.

FILE: buddypress/bp-core/admin/bp-core-admin-tools.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 629 | 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
     |       | (PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder.Removed)
----------------------------------------------------------------------

Attachments (1)

8367.diff (622 bytes) - added by dd32 4 years ago.

Download all attachments as: .zip

Change History (6)

@dd32
4 years ago

#1 @imath
4 years ago

  • Milestone changed from Awaiting Review to 6.4.0

Hi @dd32

Thanks a lot for your contribution about this. Our next major release is scheduled for december 1st, so we will include your fix asap in a maintenance release.

#2 @dd32
4 years ago

Just to note, I haven't actually run BuddyPress on PHP8, so there might be other things, but this was the only thing that came up with PHP Linting and using the work-in-progress PHPCompatibility rules.

If anyone wants to try it out, I've been using the php:rc-fpm-alpine docker image which is currently PHP8 Beta4.

#3 @imath
4 years ago

Thanks for docker image info 👍

#4 @imath
4 years ago

In 12732:

Admin: use implode() the right way into the BP site health panel

The right order of arguments of this function is $glue first and then $pieces, not the other way around as it was so far. Moreover as of PHP8 (Scheduled for Nov 26th), implode( $glue, $pieces ) only accepts args in that order, it no longer supports passing the $glue as the second arg.

Props dd32

See #8367 (trunk)

#5 @imath
4 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 12733:

Admin: use implode() the right way into the BP site health panel

The right order of arguments of this function is $glue first and then $pieces, not the other way around as it was so far. Moreover as of PHP8 (Scheduled for Nov 26th), implode( $glue, $pieces ) only accepts args in that order, it no longer supports passing the $glue as the second arg.

Props dd32

Fixes #8367 (6.0 Branch)

Note: See TracTickets for help on using tickets.