Re: How can i get the location of an exit()/die() from within register_shutdown_function()?
| From: | tedd | Date: | Wed, 16 Jul 2008 19:25:55 +0000 |
| Subject: | Re: How can i get the location of an exit()/die() from within register_shutdown_function()? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276930@lists.php.net to get a copy of this message | ||
At 2:18 PM -0400 7/16/08, Eric Butera wrote:
On Wed, Jul 16, 2008 at 1:53 PM, tedd <tedd.sperling@gmail.com> wrote:I don't really know how others debug, I work alone. But, I do all my stuff online and use the following function: function report($query, $line, $file) { echo($query . '<br>' .$line . '<br/>' . $file . '<br/>' . mysql_error()); } That gives me immediate notice of where the error occurred and what the error was. When I take my code to production, I simply comment out the echo(). I used to use a global to do that (show/not show errors), but consider all my error stuff in is one file, it's easy enough to comment out what I don't want to show. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.comAt 9:15 AM -0400 7/16/08, Eric Butera wrote:I register an error handler & a shutdown function on new features so that I can get error reports via email. I hate trying to sift thru logs and junk so I really need it in my face. Of course this is a performance hit as it actually has to send emails and parse errors, but after I haven't got any mails in a while I turn it off.As an aside, if I were to see some jibberish about a query and line numbers when I click a link I'd leave that site. (And for the archives) It is a security vuln to show full file paths to an end user. If someone is tampering with your system we shouldn't give them any more information than they can already get.It can certainly help you for debugging, but I agree, it's not for production. tedd