Skip to:
Content

Opened 2 years ago

Closed 2 years ago

#4191 closed defect (bug) (fixed)

PHP 5.4: Warnings after BuddyPress activation

Reported by: leemour Owned by:
Milestone: 1.6 Priority: normal
Severity: normal Version: 1.5.5
Component: All Components Keywords:
Cc:

Description

When using BuddyPress with PHP 5.4 (Win), I get several warnings like this:
Warning: Creating default object from empty value in D:\Sites\nesiditsa\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-catchuri.php on line 37
I managed to remove them by adding the following code before each line that causes warning:

if (!is_object($bbp->OBJECT)) {
    $bbp->OBJECT = new stdClass;
}

where OBJECT is the object causing warning.

Change History (6)

comment:1 leemour2 years ago

  • Summary changed from PHP 5.4: Warning after BuddyPress activation to PHP 5.4: Warnings after BuddyPress activation

comment:2 leemour2 years ago

  • Keywords reporter-feedback removed

comment:3 DJPaul2 years ago

  • Component changed from Core to Roles/Capability
  • Keywords reporter-feedback added; needs-patch needs-testing removed

There is a "$bbp" typo in trunk/1.6, but not in 1.5.5. Please confirm what version of BuddyPress you are running.

If you see several warnings, please share those.

comment:4 leemour2 years ago

  • Keywords dev-feedback added; reporter-feedback removed

I confirm the version of bp is 1.55.
There is a similar problem with bbPress (same type of warnings). I got the solution from here:
http://bbpress.trac.wordpress.org/ticket/1801
Full list of warnings I get for bp 1.55:
Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-loader.php on line 71

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-catchuri.php on line 37

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-functions.php on line 148

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-functions.php on line 148

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-functions.php on line 148

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-functions.php on line 148

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-functions.php on line 148

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-avatars.php on line 52

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-avatars.php on line 54

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-loader.php on line 167

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-core\bp-core-loader.php on line 172

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-functions.php on line 202

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-functions.php on line 202

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-functions.php on line 202

Warning: Creating default object from empty value in D:\Sites\nesiditsa-old\www\wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-functions.php on line 202

comment:5 boonebgorges2 years ago

  • Component changed from Roles/Capability to All Components
  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 1.6

We don't really have a policy of adhering to E_STRICT in BP or WP (enable it and you'll see :) ), but given that apparently these kinds of issues are being bumped from strict to regular warnings in PHP 5.4, I suppose we should fix them.

comment:6 boonebgorges2 years ago

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

(In [6023]) Don't assign values to undefined objects throughout BP. Fixes #4191. Props leemour

Note: See TracTickets for help on using tickets.