Skip to:
Content

BuddyPress.org

Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#8760 closed defect (bug) (fixed)

PHP 8.1 fatal / PHP <8 notice+warning: Trying to get property 'ancestors' of non-object

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

Description (last modified by dd32)

The current PHP Notice is being triggered on BuddyPress.org, and is a Fatal error in PHP 8.1:

E_NOTICE: Trying to get property 'ancestors' of non-object in {file}
E_WARNING: in_array() expects parameter 2 to be array, null given in {file}

PHP 8.1 Fatal error: Uncaught Error: in_array(): Argument #2 ($haystack) must be of type array, null given
in {file}

Source: GET https://buddypress.org/users/dd32/

File: wp-content/plugins/buddypress/bp-core/bp-core-filters.php
Line: 202

See PR.

Change History (6)

#2 @dd32
18 months ago

  • Description modified (diff)
  • Summary changed from PHP 8.1 fatal / PHP <8 notice: Trying to get property 'ancestors' of non-object to PHP 8.1 fatal / PHP <8 notice+warning: Trying to get property 'ancestors' of non-object

Just noting that this is a E_WARNING in PHP <8 too, I just missed the fact that it's changed from E_NOTICE+E_WARNING to E_NOTICE+E_ERROR in the sea of notices I was looking at :)

Last edited 18 months ago by dd32 (previous) (diff)

#3 @imath
18 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 10.7.0
  • Priority changed from normal to high
  • Version set to 2.2

Hi @dd32

Thanks a lot for your report & patch 🤝. I'll commit it asap.

#4 @imath
18 months ago

In 13361:

Check a BuddyPress page exists before trying to access its properties

In bp_core_menu_highlight_parent_page() when trying to determine if the displayed page has a BuddyPress page ancestor, we need to make sure the potential BuddyPress page still exists to avoid a PHP notice/error.

Props dd32

Closes https://github.com/buddypress/buddypress/pull/35
See #8760 (trunk)

#5 @imath
18 months ago

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

In 13362:

Check a BuddyPress page exists before trying to access its properties

In bp_core_menu_highlight_parent_page() when trying to determine if the displayed page has a BuddyPress page ancestor, we need to make sure the potential BuddyPress page still exists to avoid a PHP notice/error.

Props dd32

Fixes #8760 (branch 10.0)

This ticket was mentioned in Slack in #meta by dd32. View the logs.


18 months ago

Note: See TracTickets for help on using tickets.