[wp-hackers] Best practices for hunting depreciated functions.

Peter Westwood peter.westwood at ftwr.co.uk
Mon Apr 25 07:16:27 UTC 2011

On 24 Apr 2011, at 17:36, Claude Needham wrote:

> Recently I attempted my first plugin.
> As part of the debugging process I turned on debugging so that I could
> keep one ssh session open with a tail on the error log -- thus showing
> me any errors and warnings.
> To my surprise any warnings and/or errors generated by my fledgling
> plugin were buried deep in a morass of warnings about depreciated
> functions.
> First of all let me say that the plugins I am using are pretty main
> stream. These are plugins found on most of the "Top Ten" lists. I'm a
> little disappointed that some of these plugins persist in using
> functions depreciated many versions back. But that is not my question
> at the moment.
> My question here is about any tricks of the trade that folks use to
> find where a function is actually being used. Most of the error
> messages listing depreciated functions. Below are two examples of the
> problem that I am running in to.
> [Sun Apr 24 11:19:27 2011] [error] [client xx.xx.xx.xx] PHP Notice:
> load_plugin_textdomain was called with an argument that is
> <strong>deprecated</strong> since version 2.7 with no alternative
> available. in /home/xxxx/public_html/wp/wp-includes/functions.php on
> line 3389, referer:
> http://www.xxxx.com/wp/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
> [Sun Apr 24 11:19:42 2011] [error] [client xx.xx2.xx.xx] PHP Notice:
> get_bloginfo was called with an argument that is
> <strong>deprecated</strong> since version 2.2! The <code>home</code>
> option is deprecated for the family of <code>bloginfo()</code>
> functions. Use the <code>url</code> option instead. in
> /home/xxxx/public_html/wp/wp-includes/functions.php on line 3387,
> referer: http://www.xxxx.com/wp/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
> I double checked wp-includes/functions.php and it is definitely not
> using load_plugin_textdomain. :)  In order to find which plugin might
> be using the depreciated function call it is necessary to grep my
> entire tree looking for any occurrence. I can do this, but it seems
> like there must be a debugging option available that would somehow
> give a peek into the call stack or in some other way point toward the
> function that contains the depreciated element.
> Assuming that I find all the plugins that are generating the error
> messages, is deactivation of these plugins the only means available to
> clean up my error log so that it becomes easier to see those errors
> and warnings generated by my code?
> I'm assuming other developers have come up against these issues during
> development. Hence, I'm assuming there must be standard practices for
> dealing with this.

Install the Debug Bar plugin (http://wordpress.org/extend/plugins/debug-bar/) and Log Deprecated Notices (
http://wordpress.org/extend/plugins/log-deprecated-notices/ )

The first will show you messages in an expand out debug panel linked in the admin bar and trys to determine the actually calling code rather than just print the standard message.
The second will do the same and also provide you with a log view - the debug bar uses code from log deprecated notices to try and determine the callee of the deprecated code from the backtrace.

In the case of your two examples the line of code mentioned is where the error is being detected and raised not where the function is called.
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5

More information about the wp-hackers mailing list