How to disable E_STRICT
I need to t开发者_开发百科urn 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.
try this.
error_reporting(E_ALL ^ E_STRICT);
This will report all errors except E_STRICT
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.
You mentioned you're using a framework (would be good to know which one) anyway you can add something like this on the very first index.php:
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('display_errors', 'On');
But make sure you're on the first index.php that gets called, meaning the very first in the stack, for certain framework that would save you some pain.
Other thing: most of the frameworks have their own config file to address production software VS. development software and they have their own way of doing things, so I would start from there....have a look at the docs and find out if there's anything there you need to change...it could be a super simple change on a config file most likely.
I was installing CMS Made simple when I ran into that error but here is how I over came it:
1) Open your php.ini file using any of your favorite editors;notepad, notepad++ or dreamweaver.
2) Press ctrl+f to fire up the find Dialog Box.
3) Type E_STRICT and click ok to jump you to the E_STRICT Line, there several E_STRICT Stuff but look for one with this kind of setting;
Common Values:
E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)
Default Value: E_ALL & ~E_NOTICE
Development Value: E_ALL | E_STRICT
Production Value: E_ALL & ~E_DEPRECATED
http://php.net/error-reporting
error_reporting = E_ALL , here the value with out the ";" is what matters so I just cleared it to:
error_reporting = (delete) and removed the E_ALL, and saved the file, I restarted all the services, and everything worked fine. Hope that works for you too!.
error_reporting(E_ALL & ~E_STRICT);
精彩评论