[buddypress-trac] [BuddyPress Trac] #7140: Class autoloading needs to check if the component is active before including the class

buddypress-trac noreply at wordpress.org
Wed Jun 29 20:29:47 UTC 2016


#7140: Class autoloading needs to check if the component is active before
including the class
--------------------------+---------------------
 Reporter:  r-a-y         |       Owner:  r-a-y
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  2.6.1
Component:  Core          |     Version:  2.6.0
 Severity:  major         |  Resolution:  fixed
 Keywords:  has-patch     |
--------------------------+---------------------

Comment (by r-a-y):

 In [changeset:"10919"]:
 {{{
 #!CommitTicketReference repository="" revision="10919"
 Core: In our class autoloader, check if the component is active before
 attempting to include it.

 In #6853, we introduced class autoloading to help reduce the amount of
 memory used by BuddyPress on any given page request.

 This caused a problem in some BuddyPress plugins that previously relied on
 a `class_exists()` check to determine if a BuddyPress component is active
 or not.  For example, `if ( class_exists( 'BP_Group_Extension' ) ) {}`.

 In BuddyPress 2.6.0, `class_exists( 'BP_Group_Extension' )` will now
 return
 true all the time by default.  In some instances, this can cause a fatal
 error if the Groups component is disabled.

 This commit adds a component check before including the class, while
 allowing core classes and PHPUnit to load as usual.

 Plugin developers should read the following development post for more
 details:
 https://bpdevel.wordpress.com/2016/06/28/class-autoloading-and-what-this-
 means-for-plugin-developers/

 Fixes #7140 (trunk).
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7140#comment:12>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list