manix Posted August 7, 2011 Share Posted August 7, 2011 Hello, Is there any way to detect an error/warning/notice that occurs at any point of processing the script? Link to comment https://forums.phpfreaks.com/topic/244116-stop-script-on-error/ Share on other sites More sharing options...
requinix Posted August 7, 2011 Share Posted August 7, 2011 Some types of errors, yes. (The others, no.) Link to comment https://forums.phpfreaks.com/topic/244116-stop-script-on-error/#findComment-1253683 Share on other sites More sharing options...
Adam Posted August 7, 2011 Share Posted August 7, 2011 It depends on your definition of "detect". Yes you can create a generic handler, to customise how you handle the errors, but you can't detect within a block of code if one was produced (well I suppose it's possible, but no practical). Nor should you need to though! PHP errors should be fixed during development. Link to comment https://forums.phpfreaks.com/topic/244116-stop-script-on-error/#findComment-1253686 Share on other sites More sharing options...
manix Posted August 7, 2011 Author Share Posted August 7, 2011 I am having in mind when someone uses the inspect element (chrome) option to edit something that might result in an error on my script (like hidden inputs in which I pass data to other pages) then I shall terminate the process and send the user to the index page. and I think get_error_last() would do fine. Thank you. Link to comment https://forums.phpfreaks.com/topic/244116-stop-script-on-error/#findComment-1253688 Share on other sites More sharing options...
Adam Posted August 7, 2011 Share Posted August 7, 2011 As I was saying, you don't need to handle the errors to avoid issues like this. Your code should check the inputs are valid before trying to do anything with them. Link to comment https://forums.phpfreaks.com/topic/244116-stop-script-on-error/#findComment-1253690 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.