[PHP] Error Handling!
I want errors reported on a page when the mail() function for any reason fails to send emails. FOr example, if there is a malformed email address or anything, and the mail is not sent, how can i catch the Error and Display it on the page? Thanks, T. Edison Jr. = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error Handling
At our web hosting facillity we have several developers (each who recieve a seperate email when an error occurs on the site there working on) and we would like to have extra data included in the log files which are written (such as the $_POST, $_GET, $_ENV, and $_SERVER arrays), this would help us to figure out more precisely why exactly an error occured for a particular user. I already looked at the error_append entry which allows you to append code to an error message but it appears that does not carry over to the log file, is there anyway to make all these arrays dump into the error log after each error entry (I know there is probably a way to do it with some combination of OR and die(customError()) or something, but it would be nice if the built in error handling could do it.). Thanks, Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error handling
Hi everybody, I hope u can help me with this. This file should give me an error msg that there is time-out coz of the loop. But it's not giving me anything. What could be the problem? Thx a lot FATAL [$errno] $errstr\n"; echo " Fatal error in line ".$errline." of file ".$errfile; echo ", PHP ".PHP_VERSION." (".PHP_OS.")\n"; echo "Aborting...\n"; exit (1); break; case ERROR: echo "ERROR [$errno] $errstr\n"; break; case WARNING: echo "WARNING [$errno] $errstr\n"; break; default: echo "Unkown error type: [$errno] $errstr\n"; break; } } // function to test the error handling function scale_by_log ($vect, $scale) { if ( !is_numeric($scale) || $scale <= 0 ) trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", FATAL); if (!is_array($vect)) { trigger_error("Incorrect input vector, array of values expected", ERROR); return null; } for ($i=0; $i -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error handling
Hi! There is in PHP some way to handle errors like in other languages, I mean, something like this: . . . try to do ... if error then do ... . . . I'm tired of reciving warnings :-( -- Yoel Benitez Fonseca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] error handling
How can I disable the display of error to the browser window from within the script? I want to do a redirect based on the error and cannot because header info has already been sent. Thanks, Pat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Error Handling
Hey, A Site one of my sites is hosted on(H4P), with it's php, when there is an error, it just doesn't display the page, any one ever had this problem? I tried it on another server, removed the error works on both now, but i don't want to have to switch just to test it, so does any one know the problem? :) - James "ReDucTor" Mitchell P.S It's not my server, I didn't make it to it :) hehe
[PHP] Error Handling
Is there a good write up out there or can anyone offer some insight to the rest of us as to how error handling should be properly implemented? Yes, PEAR has some error handling routines, but it doesn't have any kind of information as to how it should be "properly" implemented. I've just finished writing a pretty decent error handling class of my own but going through my code, I see places where I can add the trigger_error() function, but beyond that, I'm not sure exactly how to process it all. Up to now, I've just been doing some generic error handling. If a query fails, if a user enters the wrong value, I print out a message. But now that I'm handling all the errors, I'm finding that I'm getting so many more messages from PHP than I was before. For example, if a variable wasn't "properly" initialized (ie, I'll get an error in this case: $mode = "add"; if( $mode == "add" ) { $joe = "bob"; } if( $joe ) { echo "You got here"; } an error will be thrown by PHP saying that $joe is uninitialized) It's not as if that's a big deal. It isn't. But since I'm getting more information than I need to actually give the end user, it seems like kind of a daunting task to start handling the errors myself. It is something we are going to need to do so I cannot put it off. But I am hoping that there is some sort of write up or tutorial or something out there where I can learn from the experience of others as to how something like this should be done "properly". I'd rather do something of this magnitude right the first time. As an aside, in writing this class and seeing how PHP works in this regard, I've so much more respect for what PHP actually does behind the scenes with regards to error and syntax checking. It was definitely a learning experience. Chris
Re: [PHP] Error Handling!
On Tue, 12 Mar 2002, Thomas Edison Jr. wrote: > I want errors reported on a page when the mail() > function for any reason fails to send emails. FOr > example, if there is a malformed email address or > anything, and the mail is not sent, how can i catch > the Error and Display it on the page? the easiest way is: > > Thanks, > T. Edison Jr. > > > > = > Rahul S. Johari (Director) > ** > Abraxas Technologies Inc. > Homepage : http://www.abraxastech.com > Email : [EMAIL PROTECTED] > Tel : 91-4546512/4522124 > *** > > __ > Do You Yahoo!? > Try FREE Yahoo! Mail - the world's greatest free email! > http://mail.yahoo.com/ > > -- Jan Rademaker <[EMAIL PROTECTED]> http://www.ottobak.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Handling!
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > I want errors reported on a page when the mail() > function for any reason fails to send emails. FOr > example, if there is a malformed email address or > anything, and the mail is not sent, how can i catch > the Error and Display it on the page? > > Thanks, > T. Edison Jr. I don't think that is really posible. The mail() function doesn't actually send the mail; all it does is hands it off to the defined MTA which looks after the sending etc. There have been numerous discussions on the list about how to check a mail address - have a look over those and see if there is something suitable for checking the address before processing it with mail(). Also, I recall there is a header item something like Errors to: in which you can define an address which will receieve error messages from the MTA; you'll need to check the RFCs for the correct definition. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error handling
What warnings are you receiving? Many can be avoided by doing various checks: e.g. if (!isset($some_variable)) ...some error code else ...all is well others which may be useful: function_exists() file_exists() HTH Neil Yoel Benitez Fonseca wrote: > Hi! > > There is in PHP some way to handle errors like in other languages, > I mean, something like this: > > . > . > . > try to do > ... > if error then do ... > . > . > . > > I'm tired of reciving warnings :-( > > -- > Yoel Benitez Fonseca > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > *** > This message was virus checked with: SAVI 3.52 > last updated 17th December 2001 > *** -- Email: [EMAIL PROTECTED] [EMAIL PROTECTED]
[PHP] error handling prob
to handle errors i have this in .htaccess: e.g ErrorDocument 404 http://www.mysite.com/error/error.php but on error.php the 'REDIRECT_' vars contain nothing e.g REDIRECT_URL etc. why so? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] error handling
On Thu, 15 Feb 2001 11:42, Patrick Brown wrote: > How can I disable the display of error to the browser window from > within the script? I want to do a redirect based on the error and > cannot because header info has already been sent. > > Thanks, > Pat Try an @ prepended to the function that triggers the error, then test for the error. @ should prevent the display of the error message. -- David Robley| WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] error handling
In article <96faad$h9k$[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Patrick Brown") wrote: > How can I disable the display of error to the browser window from within the > script? I want to do a redirect based on the error and cannot because header > info has already been sent. Use the "@" sign. Example @some_function() -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] error handling
OK, I tried the @ symbol. It seemed to just disable error checking altogether. I have this in my code that I'd like to use. if (!$php_errormsg) { header("Location: http://www.domain.com/admin/index.php"); } else { header("Location: http://www.domain.com/admin/error.html"); } "CC Zona" <[EMAIL PROTECTED]> wrote in message 96fcv5$2o0$[EMAIL PROTECTED]">news:96fcv5$2o0$[EMAIL PROTECTED]... > In article <96faad$h9k$[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Patrick > Brown") wrote: > > > How can I disable the display of error to the browser window from within the > > script? I want to do a redirect based on the error and cannot because header > > info has already been sent. > > Use the "@" sign. Example > > @some_function() > > -- > CC > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Error Handling class
I've looked around but haven't really found one... Does anyone know where I can find a class (or a set of functions) that handles errors gracefully? I'm about to write something to do this but would rather not reinvent the wheel. thnx, Chris
[PHP] error handling and __LINE__
Hi, I wonder if there's a way to find the line number of the calling script from a function, like the error messages PHP generates. An example: In an included file I have a function and want to do something similar to: function foo($obj) { if (!is_object($obj)) { echo "Error: supplied argument is not an object in "; echo __FILE__ . " line " . __LINE__; } ... } But __FILE__ and __LINE__ refers to the current file, ie. the file with the function in, and not the file where the function is called from. The first one I can solve by using $SCRIPT_NAME, but what about the line number??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Error Handling class
the PEAR library has an error class -Stewart. -Original Message- From: Boget, Chris [mailto:[EMAIL PROTECTED]] Sent: 12 April 2001 16:19 To: Php (E-mail) Subject: [PHP] Error Handling class I've looked around but haven't really found one... Does anyone know where I can find a class (or a set of functions) that handles errors gracefully? I'm about to write something to do this but would rather not reinvent the wheel. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Error Handling Class - Any Recommendations?
Anyone recommend a good one? I am in need of the following features: 1) Catch any type of errors, 2) Actions like: Show on the screen, log on a file or database, or email, 3) Different actions for each error level/warning type, etc.. I have searched Hotscripts, but only found classes to control server errors, like 404 or 503. On Sourceforge, no projects with files, and Google returns me thousands of unrelated pages and I couldn't filter the results until they were satisfactory ;-) I understand PEAR has somekind of error control, and it's my current DB Abstraction Layer's choice. If there's a way to keep using PEAR to handle other errors, I would be very glad if someone could point me to any tutorial or documentation about how to do so, Thanks, -- Julio Nobrega. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error handling and __LINE__
try, assert() instead of echo()ing error messages. assert('is_object($obj)'); and write your error handler code or use mine :) or am i missing something? Papp Gyozo - [EMAIL PROTECTED] - Original Message - From: "SafeV" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 22, 2001 4:15 PM Subject: [PHP] error handling and __LINE__ | Hi, | I wonder if there's a way to find the line number of the calling script | from a function, like the error messages PHP generates. An example: | | In an included file I have a function and want to do something similar to: | | function foo($obj) { | if (!is_object($obj)) { | echo "Error: supplied argument is not an object in "; | echo __FILE__ . " line " . __LINE__; | } | ... | } | | But __FILE__ and __LINE__ refers to the current file, ie. the file with | the function in, and not the file where the function is called from. | The first one I can solve by using $SCRIPT_NAME, but what about the line | number??? | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] |
Re: [PHP] error handling and __LINE__
Thanks, assert() is cool, but it still reports the filename and line number of the included file with the function in which the error occurred, not the script that called the functon with illegal arguments. Or...??? Eg.: index.php: This will produce a message saying an error occurred in functions.php, but I want it to tell me that the error occurred in index.php, line 3. Because if I call foo() many times in a script, it is difficult to find out which call that failed. Is this impossible? Papp Gyozo wrote: > try, assert() instead of echo()ing error messages. > > assert('is_object($obj)'); > > and write your error handler code or use mine :) > or am i missing something? > > Papp Gyozo > - [EMAIL PROTECTED] > > - Original Message - > From: "SafeV" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, November 22, 2001 4:15 PM > Subject: [PHP] error handling and __LINE__ > > > | Hi, > | I wonder if there's a way to find the line number of the calling script > | from a function, like the error messages PHP generates. An example: > | > | In an included file I have a function and want to do something similar to: > | > | function foo($obj) { > | if (!is_object($obj)) { > | echo "Error: supplied argument is not an object in "; > | echo __FILE__ . " line " . __LINE__; > | } > | ... > | } > | > | But __FILE__ and __LINE__ refers to the current file, ie. the file with > | the function in, and not the file where the function is called from. > | The first one I can solve by using $SCRIPT_NAME, but what about the line > | number??? > | > | > | > | -- > | PHP General Mailing List (http://www.php.net/) > | To unsubscribe, e-mail: [EMAIL PROTECTED] > | For additional commands, e-mail: [EMAIL PROTECTED] > | To contact the list administrators, e-mail: [EMAIL PROTECTED] > | > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Error Handling Class - Any Recommendations?
On Thursday, April 18, 2002, at 08:53 AM, Julio Nobrega Trabalhando wrote: > Anyone recommend a good one? I am in need of the following features: > > 1) Catch any type of errors, > 2) Actions like: Show on the screen, log on a file or database, or > email, > 3) Different actions for each error level/warning type, etc.. If you want to roll your own, there's a DevShed article on the subject -- but I haven't read it, so I can't give you an opinion as to how good it is (whatever that would be worth). http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error handling and the usage of "@"
Could someone give me an example of the sort of error handling you put in your php scripts? Cheers. Should I be preceding every command with @? Anything where this would be harmful? Just looking for some pointers really :-) - seb --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Error Handling: How to handle fatal errors?
Hello, I have red all about Error handling but there isn't mentionet that user cant handle fatal errors :( I'm writing some application and need to hide all fatal errors from user and do some hidden reporting/logging such errors. But the handler function set by set_error_handler() din't get control when fatal error occurs. Is there way to solve my problem. Regards, Darius Ivanauskas -- P.S. Sorry for my english, it isn't my first language .. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]