[wp-trac] [WordPress Trac] #20298: Change requires to require_once

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 24 22:39:21 UTC 2012


#20298: Change requires to require_once
-------------------------+-----------------------------
 Reporter:  pp3345       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.3.1
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 Wordpress partially uses "require" to include files. I'd prefer to have
 require_once everywhere where a file really shouldn't be included twice.
 I'm currently developing an HTTP-Server
 (https://github.com/pp3345/Pancake) with a function to keep "static"
 codefiles (for example files that only do class-definitions and don't
 actually really execute any code) in some kind of a cache so that they
 don't need to be loaded again on every single request in order to improve
 performance. When I now, for example, load the wp-includes/class-wp-
 walker.php into the cache at the beginning and then Wordpress tries to
 require the file again, it fails with an Fatal Error due to trying to
 define the class again. Using require_once instead of require in Wordpress
 can be done quickly and would easily fix this. Also, it could improve the
 codes quality a bit.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20298>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list