i have a page simply like this:
error_reporting(-1);
require('test.txt');
i know that test.txt not exists .i want to try error_reporting() function. in this case that we pass number -1 to function all error reported correctly like this:
Warning: require(test.txt) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\PHP_Class\session_5\errors.php on line 11
Fatal error: require() [function.require]: Failed opening required 'test.txt' (include_path='.;C:\php\pear') in C:\wamp\www\PHP_Class\session_5\errors.php on line 11
and when we pass number 2 to function like error_reporting(2) only E_WARNING error reported and this is correct too:
Warning: require(test.txt) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\PHP_Class\session_5\errors.php on line 11
but when i pass number 1 to function like error_reporting(1) for report E_ERROR errors only , no error display. what is problem? please tell me
I think require doesn't throw an E_ERROR but an E_COMPILE_ERROR.
So please try it with error_reporting(E_COMPILE_ERROR);
how about this
error_reporting (E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED) ;
this should give you all the errors you require
UPDATE
chk this url
http://www.php.net/manual/en/function.require.php
it says
include except upon failure it will also produce a fatal E_COMPILE_ERROR level error.
so this code will always give the compile error.... And the config above will be best suited for you production env..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With