Skip to:

Opened 13 years ago

Closed 13 years ago

#3440 closed defect (bug) (fixed)

foreach error when you delete bp_pages from db

Reported by: modemlooper's profile modemlooper Owned by:
Milestone: 1.5 Priority: minor
Severity: minor Version: 1.5
Component: Core Keywords: has-patch


If you delete the bp_pages entry in wp-options from database it causes a foreach error. I know most people will not do this and you can easily fix by re association pages but a little error checking could be added.

Change History (6)

#1 @enderandrew
13 years ago

Are you talking about:

Warning: Invalid argument supplied for foreach() /htdocs/wp-content/plugins/buddypress/bp-core/bp-core-functions.php on line 95

Because I'm getting that all of a sudden. I had the error where pages were spamming left and right and was advised to wipe bp_pages in wp-options.

#2 @enderandrew
13 years ago

And shouldn't like 95 be:

foreach( (array)$page_ids as $component_name => $page_id ) {

It is currently:

foreach( $page_ids as $component_name => $page_id ) {

#3 @boonebgorges
13 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 1.5
  • Priority changed from normal to minor
  • Severity changed from normal to minor
  • Version set to 1.5

enderandrew - Yes, that's the fix.

#4 @boonebgorges
13 years ago

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

(In [4927]) Don't throw PHP notice when bp-pages meta value is deleted manually from database. Fixes #3440. Props enderandrew

#5 @enderandrew
13 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Sadly, in applying this patch I now get a new error.

Fatal error: Cannot unset string offsets in /htdocs/wp-content/plugins/buddypress/bp-core/bp-core-functions.php on line 97

Line 97 is:

unset( $page_ids[$component_name] );

That sure looks like an array, and not a string there. So I'm at a loss. But this is why I'm not a developer.

Version 0, edited 13 years ago by enderandrew (next)

#6 @boonebgorges
13 years ago

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

(In [4933]) Avoid variable type errors when bp-pages is manually deleted from database. Fixes #3440

Note: See TracTickets for help on using tickets.