Debug Bar
Use of undefined constant E_DEPRECATED - assumed 'E_DEPRECATED' (2 posts)

  1. Chris Reynolds
    Posted 1 year ago #

    Getting this error. Strangely it's only appearing on a single custom post type page that displays a get_the_terms of the custom taxonomies it's filed in, and specifically tied to get_term_link (when I comment out the get_term_link, the notice disappears). This seems coincidental since the symptom appears to be totally unrelated to the cause (but feel free to let me know if I'm _doing_it_wrong and that's why it's getting thrown).

    Here's the full error(s):

    Notice: Use of undefined constant E_DEPRECATED - assumed 'E_DEPRECATED' in /path/to/wp-content/plugins/debug-bar/panels/class-debug-bar-php.php on line 44
    Notice: Use of undefined constant E_USER_DEPRECATED - assumed 'E_USER_DEPRECATED' in /path/to/wp-content/plugins/debug-bar/panels/class-debug-bar-php.php on line 45

    Changing E_DEPRECATED and E_USER_DEPRECATED on lines 44 and 45 of the file listed removes the notices.


  2. jrf
    Posted 1 year ago #

    Came across this as well. Here's the full solution in case anyone else comes across this:

    File: /panels/class-debug-bar-php.php
    Find line 30-31:

    function error_handler( $type, $message, $file, $line ) {
    	$_key = md5( $file . ':' . $line . ':' . $message );

    Replace with:

    function error_handler( $type, $message, $file, $line ) {
    	$_key = md5( $file . ':' . $line . ':' . $message );
    	if ( !defined( 'E_STRICT' ) )			define( 'E_STRICT', 2048 );
    	if ( !defined( 'E_RECOVERABLE_ERROR' ) ) define( 'E_RECOVERABLE_ERROR', 4096 );
    	if ( !defined( 'E_DEPRECATED' ) )		define( 'E_DEPRECATED', 8192 );
    	if ( !defined( 'E_USER_DEPRECATED' ) )	define( 'E_USER_DEPRECATED', 16384 );

    The constants which I add are PHP constants which were added in later versions of PHP and are therefore not available in all versions. This will solve that.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic