[wp-trac] [WordPress Trac] #36335: Next generation: core autoloader proposal

WordPress Trac noreply at wordpress.org
Thu Sep 1 06:20:52 UTC 2016


#36335: Next generation: core autoloader proposal
-----------------------------+------------------
 Reporter:  dnaber-de        |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  4.7
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:
-----------------------------+------------------

Comment (by dnaber-de):

 Replying to [comment:137 azaozz]:
 > Right. In "pluggable.php" this is the intended behaviour, and the design
 is bad. However because of the way WordPress works, adding standard
 autoloading of classes introduces exactly the same design flaws like in
 pluggable.php. Of course we can add all the documentation and warnings we
 want, but do you believe all developers will always follow them? After the
 example with the shortcodes the answer tends to be firm "No".

 Could you please explain how there's a difference between:

 {{{#!php
 <?php
 add_action( 'setup_theme', function() {
     $GLOBALS[ 'wp_rewrite' ] = new TotallyBrokenWpRewrite;
 } );
 }}}

 and

 {{{#!php
 <?php
 add_action( 'plugins_loaded', function() {
     require_once 'src/TotallyBrokenWpRewrite.php';
 } ) );
 }}}

 The last one would possibly bypass the core autoloader. The first one
 replaces the global instance. Both override the default `WP_Rewrite`
 implementation. The first one is possible right now.

 We're talking about a slightly different facet of an ''already existing
 problem''. But maybe I miss something here.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36335#comment:147>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list