Skip to:

Opened 8 years ago

Closed 8 years ago

#7203 closed defect (bug) (fixed)

BP_Core_Nav->delete_nav() generates "Array to string conversion" PHP Notice

Reported by: needle's profile needle Owned by: imath's profile imath
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6.0
Component: Navigation Keywords: has-patch


When deleting a parent nav item whose "screen function" (callback) is a method rather than a function, array_unique generates a PHP Notice: "Array to string conversion in /wp-content/plugins/buddypress/bp-core/classes/class-bp-core-nav.php on line 278". I can't quite figure out the importance of returning a unique array, since there seems to be no down side to unhooking any returned callbacks multiple times. IOW, unhooking an already-unhooked callback will have no effect.

Attachments (2)

7203.patch (3.0 KB) - added by imath 8 years ago.
7203.02.patch (1.9 KB) - added by r-a-y 8 years ago.

Download all attachments as: .zip

Change History (7)

#1 @imath
8 years ago

Hi @needle

Thanks for your feedback.

You're probably right. I need to have a look at it more carefully. We could also serialize/unserialize. See attached patch.

8 years ago

#2 @DJPaul
8 years ago

  • Milestone changed from Awaiting Review to 2.7

8 years ago

#3 @r-a-y
8 years ago

  • Keywords has-patch added

If the install is PHP 5.2.9+, we could use the second parameter to array_unique():

Maybe we can make this change for BP 2.8 when we will support PHP 5.3+.

Or, we can do what @needle recommended and that is to remove the array_unique() call for now.

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

8 years ago

#5 @r-a-y
8 years ago

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

In 11147:

Core: In bp_core_remove_nav_item(), fix notice when a nav item's screen function uses a class method as a callback.

Props needle, imath.

Fixes #7203.

Note: See TracTickets for help on using tickets.