catch an iconv E_NOTICE
| From: | Tom Worster | Date: | Thu, 24 Sep 2009 13:42:29 +0000 |
| Subject: | catch an iconv E_NOTICE | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298313@lists.php.net to get a copy of this message | ||
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 ?
}
}
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?