note 95433 added to language.exceptions

From: Date: Sun, 03 Jan 2010 12:56:13 +0000
Subject: note 95433 added to language.exceptions
Groups: php.notes 
Request: Send a blank email to php-notes+get-164559@lists.php.net to get a copy of this message
If you are using exceptions, code which will store uncaught exceptions might be nice for you, for example, PDO throws an exception, but you thought that this is impossible, so you were not even thinking about using try{...}catch(...){...}, function exception_handler($exception) { ob_start(); print_r($GLOBALS); print_r($exception); file_put_contents('exceptions.txt', ob_get_clean(). "\n",FILE_APPEND); } set_exception_handler('exception_handler'); to save a uncatched exception simply write throw new Exception('error'); somewhere in code. If we have a lot of exceptions, file will get a huge size in few minutes, but saving this kind of information may save you from, for example, being sql-injected (attempt to try to inject-sql will be saved) PS PDO ofc. must be set to throw exceptions. ---- Server IP: 69.147.83.197 Probable Submitter: 83.10.9.231 ---- Manual Page -- http://www.php.net/manual/en/language.exceptions.php Edit -- https://master.php.net/note/edit/95433 Del: integrated -- https://master.php.net/note/delete/95433/integrated Del: useless -- https://master.php.net/note/delete/95433/useless Del: bad code -- https://master.php.net/note/delete/95433/bad+code Del: spam -- https://master.php.net/note/delete/95433/spam Del: non-english -- https://master.php.net/note/delete/95433/non-english Del: in docs -- https://master.php.net/note/delete/95433/in+docs Del: other reasons-- https://master.php.net/note/delete/95433 Reject -- https://master.php.net/note/reject/95433 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164559) next »