Home > php > [php] turn off deprecated errors

[php] turn off deprecated errors

Problem
I have a PHP application running on a webserver and the system administrator sent me an email one day that the Apache log is full of PHP deprecated warning messages and it is caused by my page.

The warning message was the following:

PHP Deprecated:  preg_replace(): The /e modifier 
is deprecated, use preg_replace_callback instead 

Solution
Investigating the code, I had “preg_replace()” all over the source. No way that I would correct them manually everywhere. I chose a quick and dirty solution and added the following line to the top of the entry PHP file:

error_reporting(0); // Turn off warning, deprecated, 
                    // notice everything except error

Done, no more barking. This tip is from here.

When the application stops running and terminates with an error, I’ll update the application.

Advertisements
Categories: php
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: