[wp-trac] [WordPress Trac] #17092: use dirname(__file__).'/file.php' instead of './file' for includes

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 13 06:19:31 UTC 2011


#17092: use dirname(__file__).'/file.php' instead of './file' for includes
-----------------------------------+------------------------------
 Reporter:  ketwaroo               |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  General                |     Version:  3.1.1
 Severity:  minor                  |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------------------

Comment (by ketwaroo):

 Replying to [comment:3 sivel]:
 > We absolutely should not be doing {{{dirname( __FILE__ )}}} for every
 include, include_once, require, require_once.


 like [comment:4 dd32] said, it's only for the initial bootstrap file
 (usually wp-load.php) before ABSPATH is defined. Per script execution
 that's done only once. Actually, `dirname(__FILE__)` was already being
 used a few places.

 It is a fairly minor issue. There are only about 80 places where the
 replacements would take place. You can see them in the patch files I
 uploaded.

 > My tests show that if you do it for the roughly 200 places that
 !WordPress uses ./ that it increases memory usage by 0.087MB and increases
 execution time by 0.000830888748169 seconds.


 er.. how.. did you test that?

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


More information about the wp-trac mailing list