toreachdeepak Posted April 25, 2013 Share Posted April 25, 2013 Hi, Thanks in advance. How do we check whether the php function called generates which error ? For example, if I set the wrong timezone then I get E_NOTICE date_default_timezone_set('Asia/Kolkata'); But how do we check which E_WARNING/E_NOTICE etc is generated. Regards Deepak Bhatia Link to comment Share on other sites More sharing options...
thescientist Posted April 25, 2013 Share Posted April 25, 2013 it should give you a line number and file in which the error occurred. combined with a error type and message, that should be sufficient to resolve the issue. unless there is something else I'm missing in your question. Link to comment Share on other sites More sharing options...
boen_robot Posted April 25, 2013 Share Posted April 25, 2013 If you want to programatically detect warnings and analyze them, you have to set an error handler function, and check its arguments. See the set_error_handler() function for details. 1 Link to comment Share on other sites More sharing options...
toreachdeepak Posted April 25, 2013 Author Share Posted April 25, 2013 it should give you a line number and file in which the error occurred. combined with a error type and message, that should be sufficient to resolve the issue. unless there is something else I'm missing in your question. How do we get the error_type means E_WARNING or E_ERROR ? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 25, 2013 Share Posted April 25, 2013 For E_ERROR, you can't handle that. That error means that your code is stopping, you can't catch it and handle it. For warnings or notices, look at the link to set_error_handler. You can also use this to get information about the last error: http://www.php.net/manual/en/function.error-get-last.php 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now