Jump to content

E_ERROR/E_WARNING


toreachdeepak

Recommended Posts

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

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

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.

  • Like 1
Link to comment
Share on other sites

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

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

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...