Re: catch an iconv E_NOTICE
| From: | Tommy Pham | Date: | Thu, 24 Sep 2009 15:25:06 +0000 |
| Subject: | Re: catch an iconv E_NOTICE | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298316@lists.php.net to get a copy of this message | ||
----- Original Message ----
> From: Tom Worster <fsb@thefsb.org>
> To: PHP General List <php-general@lists.php.net>
> Sent: Thursday, September 24, 2009 6:42:29 AM
> Subject: [PHP] catch an iconv E_NOTICE
>
> i have this hack that works up to a point...
>
> function my_err_handler($errno, $errstr, $errfile, $errline) {
> if ( preg_match('/iconv/', $errstr) ) {
> throw new Exception('iconv error');
> } else {
> // ? how to invoke default error handler ?
http://www.php.net/manual/en/function.restore-error-handler.php
> }
> }
> set_error_handler("my_err_handler", E_NOTICE);
>
> try {
> $s = iconv($enc1, $enc2, $s);
> } catch (Exception $e) {
> // deal with the failed conversion
> }
>
> but i'd like proceed with default error handling in the branch with the
> question marks. how can i do that?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php