Suppressing Specific Deprecated Warnings in PHP 5.3 Without Hiding All Errors
You are dealing with a specific architectural mismatch: running WordPress 2.9.2 on a server configured for PHP 5.3, where the interpreter has started flagging legacy code patterns as deprecated. The error messages you are seeing explicitly state, "Assigning the return value of new by reference is deprecated." These warnings appear in /wp-settings.php at specific line numbers because that file relies on internal WordPress functions that were written for older PHP versions prior to 5.3.
The core issue is not necessarily that your code is broken, but that the language engine now refuses to silently ignore a pattern that used to be allowed. In PHP 5.2 and earlier, you could write &$var = new ClassName();. This syntax attempted to return an object by reference. However, starting in PHP 5.3, this construct is deprecated because it was never meant to be used with objects, only with arrays or strings, and it creates ambiguity regarding how the variable should be handled after assignment.
Your immediate goal is to suppress these specific warnings without disabling error_reporting() entirely. Turning off on-screen errors globally is a bad practice for development environments because you lose visibility into actual bugs (E_ERROR) or other deprecation notices that might indicate future breaking changes. You need surgical precision: tell PHP to ignore the E_DEPRECATED flag, but keep catching everything else.
You can achieve this by modifying your php.ini configuration file on the server level. Locate the error_reporting directive and adjust its value to exclude the deprecated constant. If your current setting is -1 (which means "report all"), change it to:
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
log_errors = On
The operator & ~ performs a bitwise AND with the bitwise NOT of E_DEPRECATED. This effectively removes the deprecated flag from the mask while retaining all other error levels. If you are using an older version of PHP where ~ might not be supported in certain contexts, you can also explicitly list the flags:
error_reporting = E_ALL | E_STRICT
Note that E_DEPRECATED is distinct from E_STRICT. While modern PHP versions often group them, in PHP 5.3 they are separate constants. If your server logs show errors but the screen remains clean, verify that display_errors is set to 1 or On, and ensure log_errors is enabled so you can still investigate issues via the error log file.
Another approach involves editing the specific file generating the noise: /wp-settings.php. You can wrap the problematic lines in a try-catch block, although that won't work for warnings, or simply add an error handler at the very top of the file to filter out these specific messages before they reach the output buffer. However, modifying core WordPress files is fragile; if you upgrade WordPress later, your changes will be overwritten. The php.ini method is superior because it applies globally and survives version upgrades.
It is important to understand that suppressing warnings does not fix the underlying logic. If a function relies on the behavior of the deprecated syntax being preserved, removing the warning might hide a functional regression. In this specific case, WordPress 2.9.2 was designed for PHP 5.2. The deprecation notices are a signal that the software is no longer compatible with your current runtime environment. While suppressing the errors allows the application to continue running, it effectively locks you into a legacy stack.
If you have the authority to update the server, consider upgrading PHP to at least version 7.x and ensuring WordPress is updated to a version that supports it. The performance improvements in modern PHP engines are substantial, and maintaining an old stack on new hardware introduces security risks. If upgrading PHP is not immediately possible due to legacy dependencies, you might consider isolating this site in a virtual machine or container where you can pin the PHP version specifically to 5.2.x to eliminate the deprecation notices entirely without affecting other services.
If you are managing multiple sites on this server and need a centralized solution, check your .user.ini files for shared hosting environments. Often, these directives override the global php.ini. Adding error_reporting = E_ALL & ~E_DEPRECATED there can be just as effective without touching server-wide configurations. Always verify the actual active configuration using a simple PHP script that outputs phpinfo() before making changes to ensure the new settings are actually being loaded by the web server process.
