Good idea to ignore errors?

I found out that on my system "error_reporting" is disabled. So I turned it on (E_ALL), and now I have quite a few errors.

if you are interested in my errors:

Notice: Undefined index: page in …path/file.php on line 22 Notice: Undefined offset: 1 in …path/file.php on line 49 Notice: Undefined offset: 2 in …path/file.php on line 57 Notice: Undefined offset: 3 in …path/file.php on line 58 Notice: Undefined variable: out in …path/file.php on line 85 Notice: Undefined variable: out in …path/file.php on line 109 Notice: Use of undefined constant M_DESCRIPTION - assumed 'M_DESCRIPTION' inpath/file.php on line 181 Notice: Use of undefined constant GA_TRACKER - assumed 'GA_TRACKER' inpath/file.php on line 291 Notice: A session had already been started - ignoring session_start() inpath/file.php on line 12 Notice: Undefined variable: attributes inpath/file.php on line 86 Notice: Undefined variable: li inpath/file.php on line 129 Notice: Undefined index: breakafterlabel inpath/file.php on line 175 Notice: Undefined index: afterlabel inpath/file.php on line 167 Notice: Undefined index: attributes inpath/file.php on line 188 Notice: Undefined index: value inpath/file.php on line 191 Notice: Undefined index: for inpath/file.php on line 163 Notice: Undefined index: attributes inpath/file.php on line 249 Notice: Undefined index: value inpath/file.php on line 299 Notice: Undefined variable: out inpath/file.php on line 109 Notice: Undefined offset: 0 inpath/file.php on line 418 Notice: Undefined index: maxlength inpath/file.php on line 368 Notice: Undefined index: accept inpath/file.php on line 372 Notice: Undefined variable: out inpath/file.php on line 93 Notice: Undefined index: accept inpath/file.php on line 378 Notice: Undefined index: title inpath/file.php on line 379 Notice: Undefined index: accept inpath/file.php on line 402 Notice: Undefined index: fp inpath/file.php on line 624 Notice: Undefined variable: alert_msg inpath/file.php on line 246 Notice: Undefined variable: returner inpath/file.php on line 87 Notice: Undefined index: body inpath/file.php on line 309 Notice: Undefined variable: out inpath/file.php on line 81 Notice: Undefined variable: defaults inpath/file.php on line 121 

At first I thought, “Oh, you better turn it off again,” but I'm not sure about the consequences!

So, a very simple question: does it matter whether I ignore all errors or not?

+4
source share
4 answers

In a development environment, it is best to work with error_reporting(E_ALL) so you can see notifications. This encourages you to have a higher coding standard.

When you start the site in real time, you MUST have display_errors off , but log your errors (just like you).

Thus, you will see only errors that make sense, and not only "Note: Undefined ...". If the website is already done, you should spend some time reorganizing your code, the long-term benefits will be worth it.

+5
source

If you just want to temporarily hide some message errors, use @:

 echo @$undefined; @session_start; 

This will not solve your error , but will make your error report clearer until you commit it .

+3
source

Answer: no! Ignoring errors can lead to unexpected behavior. In addition, it may slow down your program / script. Therefore, you better not ignore, but correct them.

In more detail: where Undefined offset errors are unproblematic in most cases, the Use of undefined constant or session_start failure can be dangerous.

+1
source

You should pay attention to errors and warnings. They say that you did something wrong.

Errors are very useful in the development environment. But when you release the code, it is better to disable them.

-1
source

All Articles