WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16439 closed defect (bug) (invalid)

When a plugins needs updating, the core code calls "has_cap" in a deprecated way

Reported by: jltallon Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has_cap, plugin_update_detect
Focuses: Cc:

Description

When WP_DEBUG is enabled, the log continuously spews the following when a plugin has a newer version available:

Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /usr/share/wordpress/wp-includes/functions.php on line 3381

Steps to reproduce:

1.- Enable logging

define('WP_DEBUG', true); Turn debugging ON

define('WP_DEBUG_DISPLAY', false); Turn forced display OFF

define('WP_DEBUG_LOG', true); Turn logging to wp-content/debug.log

2.- Activate a plugin which has a newer version

Steps to "neuter":

1.- Deactivate plugin

2.- Remove the plugin from wp-content/plugins

3.- Switch to another page (a form of "hard refresh")

The warning seems to come from wp-includes/deprecated.php, but I haven't been able to trace it to the original caller so far.

This is mostly annoying to those of us debugging, and not really an issue for production installs.

Last encountered with the "better delete revisions" plugin

Change History (3)

comment:1 SergeyBiryukov3 years ago

The problem is in the plugin itself:

        add_options_page('Better Delete Revision',
                         'Better Delete Revision',
                         8,
                         basename(__FILE__),
                         'my_options_bdelete_revision');

It should be 'manage_options' instead of 8.

comment:2 jltallon3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Indeed. Resolution verified (thanks!)

  • TinyMCE Advanced (v3.2.7) suffers from the same problem: line 268 (hey @Ozz!)

comment:3 scribu3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.