Re: Why? Why this is not an imap_error?
| From: | Curt Zirzow | Date: | Sat, 30 Aug 2003 02:42:25 +0000 |
| Subject: | Re: Why? Why this is not an imap_error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161219@lists.php.net to get a copy of this message | ||
* Thus wrote myhan (myhan@liumeiti.com):
>
> I ust imap_fetchstructure function to get the structure of a message, and I
> want to push the errors into an array.
> I give a wrong message number and expect cause an imap error, which can be
> get by using imap_errors().
> But it does not work like that. I get nothing from imap_errors(), and the
> browser print a waring like that :
>
> Warning: imap_fetchstructure(): Bad message number in
> e:\testroot\imap\index.php on line 52
>
> What can I do?
You can psudo trap the error message, if you have the php.ini
setting 'track_errors' on then you can do something like:
if (! @imap_fetchstructure(...) ) {
array_push($errors, $php_errormsg);
}
The @ suppresses direct output to the browser. and php_errormsg
contains the string that woulda been sent.
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."