Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#7392 closed defect (bug) (fixed)

PHP 7.1 compat

Reported by: DJPaul Owned by: boonebgorges
Milestone: 2.8.3 Priority: highest
Severity: normal Version:
Component: Core Keywords:
Cc: tom@…, support@…

Description

There are problems - on the website, and also in the unit tests.

Attachments (2)

7392-travis.patch (373 bytes) - added by netweb 3 years ago.
7392.diff (885 bytes) - added by boonebgorges 3 years ago.

Download all attachments as: .zip

Change History (32)

#1 @djpaul
3 years ago

In 11298:

Fix an incompatibility with PHP 7.1.

See #7392

Props stagger-lee, jonieske, lgreenwoo

#2 @DJPaul
3 years ago

The tests are failing because of a quirky bug in PHP 7.1 to do with gallery shortcode parsing. The tests on our end are probably not actually any use, but I'm going to talk to Core and let them know, and see what they want to do.

#4 @netweb
3 years ago

Related: #7406

#5 @DJPaul
3 years ago

The 2.8 branch has a fix in place for the "admin_bar_menu" PHP fatal error that occurs on PHP 7.1 (r 11298). We are waiting on fixes in WordPress (#WP39277) to fix a very-likely-but-not-confirmed issue in the Activity Stream (in the media extractor, and shortcode parsing, code); this is also breaking a unit test. (Aside: I don't know how useful this failing test is for BuddyPress, but it has proven this regression in WordPress itself).

Version 1, edited 3 years ago by DJPaul (previous) (next) (diff)

#6 @DJPaul
3 years ago

For those reading via email, I edited my last comment to fix some important dates/versions.

#7 @DJPaul
3 years ago

But we ought to backport that fix into 2.7 branch, and ship that (once we know there isn't anything else to fix on our ends -- so we need to wait for WordPress 4.7.x).

@netweb
3 years ago

This ticket was mentioned in Slack in #buddypress by netweb. View the logs.


3 years ago

#9 @netweb
3 years ago

In r11391:

Build: allow tests on Travis-CI's PHP 7.1 to fail temporarily.

There is an upstream bug in WordPress causing fatal errors for one of our tests in PHP 7.1.
It has not been fixed yet, and as I suspect the test itself is better suited for WordPress than BuddyPress (BuddyPress ought to assume that basic shortcode parsing is functional), I think this is a worthwhile tradeoff for now.

See https://core.trac.wordpress.org/ticket/39277 and #7392

Props netweb

FYI: The commit missed the ticket for some reason /shrug

#10 @DJPaul
3 years ago

  • Milestone changed from 2.8 to Future Release

#11 @boonebgorges
3 years ago

  • Priority changed from normal to highest

BP won't load on PHP 7.1 because of an issue with the way our components set up the admin bar. See http://php.net/manual/en/migration71.incompatible.php "The empty index operator is not supported for strings anymore". bp_setup_admin_bar() does the following:

do_action( 'bp_setup_admin_bar' );

which WordPress, since the introduction of WP_Hook, converts to $hook->apply_filters( '', $args ) - the first '' is an empty string passed as the missing "value" in a do_action() call. This means that all instances of 'bp_setup_admin_bar' are passed an empty string, overriding the $wp_admin_nav = array() in the function definition. When components try adding items to the array ($wp_admin_nav[] = ...), a fatal is thrown.

The smallest fix I can see is to change bp_setup_admin_bar() so that it does this instead:

apply_filters( 'bp_setup_admin_bar', array() );

But this changes the semantics a bit - our 'bp_setup_admin_bar' callbacks don't actually use the value returned from the filter, which makes it somewhat misleading to call it a "filter". Another option is to have an explicit check in each 'bp_setup_admin_bar' callback:

if ( '' === $wp_admin_nav ) {
   $wp_admin_nav = array();
}

or to remove the default $wp_admin_nav from the function definition altogether, and rely on a local variable. But neither of these will fix the problem in third-party plugins.

I'm glad to spin this off into another ticket - it's important enough that it should be fixed in the next minor release.

#12 @DJPaul
3 years ago

This "smallest fix" is already in trunk/2.8-beta; r11298.

#13 @boonebgorges
3 years ago

Ack - I don't know how I missed that. Thanks, @DJPaul.

#14 @tomdxw
3 years ago

  • Cc tom@… added

#15 @boonebgorges
3 years ago

  • Milestone changed from Future Release to 2.8.1

Found another one: You cannot close a notice on PHP 7.1 if you don't already have closed notices, for similar reasons ([] operator on a string). See 7392.diff.

Last edited 3 years ago by boonebgorges (previous) (diff)

@boonebgorges
3 years ago

#16 @boonebgorges
3 years ago

In 11438:

Ensure "closed notice" array is an array before treating it like one.

This prevents fatal errors due to illegal string operations in PHP 7.1+.

See #7392.

#17 @boonebgorges
3 years ago

In 11439:

Ensure "closed notice" array is an array before treating it like one.

This prevents fatal errors due to illegal string operations in PHP 7.1+.

Ports [11438] to the 2.8 branch.

See #7392.

#18 @boonebgorges
3 years ago

  • Milestone changed from 2.8.1 to 2.8.2

I think I found another odd one, but it can wait.

#19 @airathalitov
3 years ago

Log in WP_DEBUG mode

PHP Notice: Trying to get property of non-object in /site_path/wp-content/plugins/buddypress/bp-activity/bp-activity-template.php on line 884

WordPress 4.7.2
BuddyPress 2.8.1
PHP 7.1.2-3+deb.sury.org~xenial+1
https://airat.biz

#20 @boonebgorges
3 years ago

@airathalitov Thanks for the report. Do you have a complete stack trace on this? The error you're reporting is not PHP 7.1-specific, and suggests that a theme or plugin is doing something abnormal outside of an activity loop.

#21 @saiashirwad
3 years ago

  • Cc support@… added
  • Version set to 2.8.2

Got this error on accessing View All Forums option from Dashboard

PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /home/***/wordpress/wp-content/plugins/bbpress/includes/forums/functions.php:1800

System Information
Wordpress: 4.7.3
BBPress: 2.8.2

#22 @r-a-y
3 years ago

@saiashirwad - Your report is related to bbPress and not BuddyPress.

It looks like bbPress has fixed things up in their development branch:
https://bbpress.trac.wordpress.org/ticket/3031

Last edited 3 years ago by r-a-y (previous) (diff)

#23 @saiashirwad
3 years ago

Oops, sorry landed on wrong link, thanks for navigating me to right link.

#24 @netweb
3 years ago

  • Version 2.8.2 deleted

#25 @boonebgorges
3 years ago

In 11521:

Improve type casting when building button classes.

A failure to enforce the array caused a fatal error in PHP 7.1+.

See #7392.

This ticket was mentioned in Slack in #buddypress by hnla. View the logs.


2 years ago

#27 @mercime
2 years ago

  • Owner set to boonebgorges
  • Status changed from new to assigned

Per June 7 dev chat. Thank you :D

#28 @r-a-y
2 years ago

In 11585:

Improve type casting when building button classes.

A failure to enforce the array caused a fatal error in PHP 7.1+.

See #7392.

Backports r11521 to 2.8-branch.

#29 @r-a-y
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

@boonebgorges - I backported r11521 to the 2.8-branch since I had to commit some stuff to this branch just now.

Going to mark this as fixed.

Thanks everyone!

#30 @netweb
2 years ago

In 11649:

Build Tools: Run Travis CI tests on PHP 7.2, and WordPress 4.9 (master) allowing to fail.

Fixes #7574. See #7392.

Note: See TracTickets for help on using tickets.