Atticus
Atticus

Reputation: 6720

error_reporting(0) throws 500 error

So - strange situation I got here.

The statement error_reporting(0); has been giving me a server 500 error.

However, error_reporting(1); works just fine..

And its killing me, too many warnings for some of my URL validators. What's up with this? Any idea on how this can be fixed?

Upvotes: 0

Views: 1222

Answers (3)

gd1
gd1

Reputation: 11403

First of all, I'm sorry if I behave "smartass", but I have to tell you that if there are warnings, you should consider to fix them instead of just reduce them to silence... :)

Junk PHP code let bad things happen, and you won't like it. I understand 80% of the PHP code around is junk, but really try to fix that library, if it's not huge.

We can however try to solve the problem if you just make a simple .php file, with only one line:

<?php
error_reporting(0);
?>

and test if it fires the error. If it doesn't, the problem is not caused by error_reporting, but just triggered by it, and there's some sick stuff going on elsewhere. :)

Upvotes: 2

Jaffa
Jaffa

Reputation: 12709

error_reporting()'s value is defined with constants, so don't use direct value to set it.

If you had used the constants, you would have noticed that none of them have 0 as value.

If you want to report all errors, there is an exception to the rule : use the value -1 :

error_reporting(-1);

Source : http://us.php.net/manual/en/function.error-reporting.php

And consider fixing all warnings! (and even notices if possible)

Note : the -1 value is used to be sure that even if more error code are added, they are all included.

Upvotes: 1

Shai Mishali
Shai Mishali

Reputation: 9382

try error_reporting(E_ALL); and ini_set("display_errors","On"); and check the errors that occur. After you fix those, there shouldn't be any problem.

Good luck
Shai.

P.S. i would be guessing for almost 100% that you use Chrome, because for some reason chrome would sometimes just show its own error screen instead of showing error messages. So also try another browser just to check the errors.

Upvotes: 2

Related Questions