[wp-trac] [WordPress Trac] #11059: Discourage plugin authors calling wp-config.php directly

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 2 08:41:18 UTC 2009


#11059: Discourage plugin authors calling wp-config.php directly
-------------------------+--------------------------------------------------
 Reporter:  strider72    |       Owner:            
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  General      |     Version:  2.9       
 Severity:  normal       |    Keywords:  has-patch 
-------------------------+--------------------------------------------------

Comment(by xenlab):

 With WP_DEBUG set to true, and the patch applied, I created this little
 plugin. I hard coded the path to wp-config to make it easy and consistent
 for front-end and wp-admin. ''Most of the offending plugins this patch
 seeks to discourage, torture themselves trying to figure out paths to the
 files they shouldn't include.''

 {{{
 <?php
 /*
         Plugin Name:    Test
         Version:                0.1
         Plugin URI:             http://xentek.net/
         Description:    test
         Author:                 Eric Marden
         Author URI:             http://xentek.net/
 */
 $path = '/Users/xentek/Sites/wordpress/';
 include($path.'/wp-config.php');
 add_action('init','myaction');

 function myaction()
 {
         return true;
 }

 ?>

 }}}

 The only errors I get are due to constants being redefined. No deprecation
 warnings, and surprisingly no complaint about _deprecated_file(), though
 dd32 is probably correct in saying that its not defined, since it lives in
 wp-includes/functions.php

 Either way, it doesn't seem to do the trick.

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


More information about the wp-trac mailing list