Opened 4 years ago

Closed 4 years ago

#9826 closed enhancement (wontfix)

Prevent including pluggable.php by plugins

Reported by: lilyfan Owned by:
Priority: low Milestone:
Component: Plugins Version: 2.7.1
Severity: major Keywords: has-patch
Cc:

Description

It is a bad manner to include wp-includes/pluggable.php by plugins.

Some plugins (such as Events Calendar) DOES the implementation, and cause confliction with other plugins which overloads the functions in pluggable.php

To prevent this implementation, insert some code to check the valid timing to load pluggable.php.

At line 478 of wp-settings.php

if ( defined('WP_PLUGGABLE_READY') ) {
  die ( __('A bad plugin attempted premature load of pluggable.php') );
}
define ('WP_PLUGGABLE_READY', true);
require (ABSPATH . WPINC . '/pluggable.php');

At top of wp-includes/pluggable.php

<?php
if ( !defined('WP_PLUGGABLE_READY') ) {
  die ( __('A bad plugin attempted premature load of pluggable.php') );
}

Change History (1)

comment:1   DD324 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

That plugin should change its behaviour, There is NO reason why it should have to do that, All plugin code needs to be run on, or after, the plugins_loaded hook fires.

Invalid due to bad plugin behavior, Closing as wontfix, since checking for things like that adds extra overhead which really isnt needed.. esp. not when the plugin author should be fixing it instead.

Note: See TracTickets for help on using tickets.