WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 'PHP Deprecated' warnings on every screen (10 posts)

  1. arothman
    Member
    Posted 5 years ago #

    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

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  3. arothman
    Member
    Posted 5 years ago #

    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!

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  5. arothman
    Member
    Posted 5 years ago #

    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. :)

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  7. arothman
    Member
    Posted 5 years ago #

    Otto, you magnificent bastard!

    Much obliged...

  8. ruslany
    Member
    Posted 5 years ago #

    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.

  9. Suki80
    Member
    Posted 4 years ago #

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

  10. ulyss
    Member
    Posted 4 years ago #

    On your server, edit the file php.ini

    Put a semicolon(;) before the line "error_reporting ="

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.