toreachdeepak 1 Posted April 25, 2013 Report 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 Quote Link to post Share on other sites
thescientist 231 Posted April 25, 2013 Report 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. Quote Link to post Share on other sites
boen_robot 107 Posted April 25, 2013 Report 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 Quote Link to post Share on other sites
toreachdeepak 1 Posted April 25, 2013 Author Report 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 ? Quote Link to post Share on other sites
justsomeguy 1,135 Posted April 25, 2013 Report 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.