[wp-trac] [WordPress Trac] #22251: Helper function to simplify checking for constants

WordPress Trac noreply at wordpress.org
Mon Oct 22 05:06:19 UTC 2012


#22251: Helper function to simplify checking for constants
-------------------------+------------------------------
 Reporter:  evansolomon  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by MikeSchinkel):

 Replying to [comment:7 wonderboymusic]:
 > Sounds great, until that all gets obliterated by:
 http://core.trac.wordpress.org/browser/trunk/wp-settings.php#L244

 After re-reading your comment I think I see what you are saying. My P.O.C.
 does the following to deal with the issue:

 {{{
 /*
  * Early in /wp-settings.php
  */
 $wp_const = $wp;
 unset( $wp );  // Some functions like register_taxonomy() will use $wp if
 it exists.
 ...
 $wp = new WP();
 /*
  * This immediately follows the preceding line that assigns new WP() to
 $wp.
  */
 foreach( get_object_vars( $wp_const ) as $property_name => $property_value
 ) {
   $wp->$property_name = $property_value;
 }
 unset( $wp_const );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22251#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list