WordPress.org

Support

Support » Installation » [Resolved] ‘PHP Deprecated’ warnings on every screen

[Resolved] ‘PHP Deprecated’ warnings on every screen

  • Hi all,

    I’m attempting to install WordPress 2.7 on a Win2003 server with PHP 5.3. I’m getting this litany of messages at the bottom of every screen… any idea how to either fix the problem or hide the warnings? I’ve attempted to turn off the messages in the php.ini, but they persist…

    Thanks!
    Drew

    PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 512 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 527 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 534 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 570 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-includes\cache.php on line 103 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-includes\query.php on line 61 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-includes\theme.php on line 1109

Viewing 9 replies - 1 through 9 (of 9 total)
  • That indicates that you’re running a really new version of PHP 5, which adds those warnings on older PHP 4 compatible code. Annoying, huh?

    Add this to the top of your wp-config.php file, right after the first <?php line:
    error_reporting(0);

    That will turn off warnings and such.

    You, sir, are a gentleman and a scholar. Been looking for that answer all day!

    I have added the new line to query, cache, theme, and settings.php, but I am still getting this one last message:

    PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-includes\cache.php on line 105

    I know that the error reporting (0) is working in the cache.php because when I remove it I get even more errors, but that one line 105 message is still popping. Any idea how to kill that last one?

    Thanks!

    I have added the new line to query, cache, theme, and settings.php

    No, no, just add it to the main wp-config.php file. That’s the only place you need it in all of WordPress.

    Well, when I added it to the wp-config.php I still had about half of the errors… as I added it to the others, the errors went away… except for that last one, which is still showing up. 🙂

    Ugh. Dang, I forgot that wp-settings screws with the error_reporting settings too.

    In your wp-settings.php file, you’ll find this code:

    // Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development.
    if (defined('WP_DEBUG') and WP_DEBUG == true) {
    	error_reporting(E_ALL);
    } else {
    	error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
    }

    Change that “E_ALL ^ E_NOTICE ^ E_USER_NOTICE” bit to zero.

    Otto, you magnificent bastard!

    Much obliged…

    I changed the wp-settings.php file as described and most of the warnings are gone, but there are a couple of warnings still reported for the wp-settings.php file itself:

    PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\inetpub\wwwroot\wordpress\wp-settings.php on line 472 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\inetpub\wwwroot\wordpress\wp-settings.php on line 487 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\inetpub\wwwroot\wordpress\wp-settings.php on line 494 PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\inetpub\wwwroot\wordpress\wp-settings.php on line 530

    Looks like the error_reporting setting does not take effect on this file. If I move the entire condition into wp-config.php, then I do not get any warnings.

    try put & ~E_DEPRECATED mask, i.e:
    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

    On your server, edit the file php.ini

    Put a semicolon(;) before the line “error_reporting =”

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] ‘PHP Deprecated’ warnings on every screen’ is closed to new replies.
Skip to toolbar