Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable E_STRICT

Tags:

php

I need to turn off E_STRICT. I have error_reporting = E_ALL & ~E_STRICT in my php.ini but it seems to be ignored. I tried this in my code:

ini_set('error_reporting', E_NOTICE);

Nothing!

Please help.

like image 635
rtacconi Avatar asked May 17 '10 16:05

rtacconi


People also ask

How do I turn off PHP error reporting?

To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: <? php error_reporting(0); ?>

How do I enable PHP error reporting?

The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);


2 Answers

try this.

error_reporting(E_ALL ^ E_STRICT);

This will report all errors except E_STRICT

like image 138
Dinesh Nagar Avatar answered Oct 06 '22 06:10

Dinesh Nagar


If you've got your own error handler (search your code for set_error_handler), then the error_reporting config value will be ignored:

It is important to remember that the standard PHP error handler is completely bypassed for the error types specified by error_types unless the callback function returns FALSE. error_reporting() settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of error_reporting and act appropriately. Of particular note is that this value will be 0 if the statement that caused the error was prepended by the @ error-control operator.

http://php.net/manual/en/function.set-error-handler.php

Also removing E_STRICT from the error_reporting config could fail, if the error occurs in the same file where error_reporting(...) (or ini_set('error_reporting, ...')) is called.

like image 37
stofl Avatar answered Oct 06 '22 06:10

stofl