• Hi there,
    Since an upgrade to 4.3.1, I’ve been receiving some odd errors and have lost the connection on a few sites to the database. I fixed this through some minor odd machinations, but what concerns me is the next error message after addressing the db connection:

    ERROR MESSAGE
    Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct()
    instead. in /home/rootname/public_html/domains/domainname.com/wp-includes/functions.php on line 3457

    So downloaded the wp-includes/functions.php file, went to line 3457 which is:
    trigger_error( sprintf( __( ‘The called constructor method for %1$s is deprecated since version %2$s!… etc.

    and then I changed the deprecated function below to false (all caps and bold below).

    My question is, is this going to be a problem for me later down the line if I don’t change it back to the default true setting?

    Thanks for anyone who can answer!

    * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
    */
    if ( WP_DEBUG && apply_filters( ‘deprecated_constructor_trigger_error’, FALSE ) ) {
    if ( function_exists( ‘__’ ) ) {
    trigger_error( sprintf( __( ‘The called constructor method for %1$s is deprecated since version %2$s! Use %3$s instead.’ ), $class, $version, ‘

    __construct()

    ‘ ) );
    } else {
    trigger_error( sprintf( ‘The called constructor method for %1$s is deprecated since version %2$s! Use %3$s instead.’, $class, $version, ‘

    __construct()

    ‘ ) );
    }
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • You shouldn’t edit core files like this because you’re going to lose this change whenever WP is updated in the future, to fix bugs or security issues. Instead, you can temporarily suppress the message by setting WP_DEBUG to false in wp-config.php or by asking your host to disable PHP’s display_errors setting.

    In this particular case, this is an important warning to be aware of because whichever theme or plugin is generating this error will stop working once PHP 7 is released. WordPress is giving you some advance notice so you won’t be caught out when it happens.

    Thread Starter madcomm

    (@madcomm)

    Luckily I can just reset the ‘WP_DEBUG’ in wp-config to false. I’ll actually try to find the issues on the web sites that are having the use __construct() problem and then restore the core files (eventually).

    Thank you for the reply, link and advice. Very much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Functions.php Error On Line 3457 – No Database Connection’ is closed to new replies.