[wp-hackers] DEBUG config and blocking notices

Andrew Nacin wp at andrewnacin.com
Tue Jul 20 04:11:33 UTC 2010


On Mon, Jul 19, 2010 at 9:33 PM, Mike Schinkel <mikeschinkel at newclarity.net>
wrote:

> P.S. I tried it again and it seems that it even throughs errors in core
> code (or at least it seems that way.)  The following error came from my call
> to add_submenu_page() in an admin_menu hook:



Notice: has_cap was called with an argument that is
> <strong>deprecated</strong> since version 2.0! Usage of user levels by
> plugins and themes is deprecated. Use roles and capabilities instead. in
> /Users/mikeschinkel/Sites/client/trunk/wp-includes/functions.php on line
> 3321


You're calling add_submenu_page() and passing a user level (i.e. number)
instead of a capability (i.e. edit_theme_options).

I'm not referring to deprecated functionality. For that, I would strongly
(and shamelessly) recommend my own plugin to suppress and log those:
http://wordpress.org/extend/plugins/log-deprecated-notices/.

I'm referring to generic PHP notices like unchecked indexes and undefined
variables. If your plugin or theme gushes these out, it is nearly always
indicative of poorly written code.

You are correct that if you have numerous plugins written by others running
in a staging environment, you probably have your hands full. I did assume
Andrew was probably referring to this situation, but I never hesitate at the
chance to emphasize WP_DEBUG usage. :-)

Final note, I would love to have a checkbox where the plugin developer can
say, "Tested on WP_DEBUG."


More information about the wp-hackers mailing list