mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Implement user conversion error handler support. Works as normal error
handler, in that it can return false to make the default one take over. Handler signature is: user_handler($direction, $encoding, $char_byte, $offset, $message) Also removed support for using exceptions in default error handler.
This commit is contained in:
parent
9573e77249
commit
e875205714
6 changed files with 115 additions and 37 deletions
|
@ -62,7 +62,7 @@ static PHP_FUNCTION(unicode_decode)
|
|||
status = U_ZERO_ERROR;
|
||||
num_conv = zend_convert_to_unicode(conv, &dest, &dest_len, str, str_len, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
zend_raise_conversion_error_ex("could not decode binary string", conv, ZEND_TO_UNICODE, num_conv, (flags & ZEND_CONV_ERROR_EXCEPTION) TSRMLS_CC);
|
||||
zend_raise_conversion_error_ex("could not decode binary string", conv, ZEND_TO_UNICODE, num_conv TSRMLS_CC);
|
||||
efree(dest);
|
||||
ucnv_close(conv);
|
||||
RETURN_FALSE;
|
||||
|
@ -114,7 +114,7 @@ static PHP_FUNCTION(unicode_encode)
|
|||
num_conv = zend_convert_from_unicode(conv, &dest, &dest_len, uni, uni_len, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
int32_t offset = u_countChar32(uni, num_conv);
|
||||
zend_raise_conversion_error_ex("could not encode Unicode string", conv, ZEND_FROM_UNICODE, offset, (flags & ZEND_CONV_ERROR_EXCEPTION) TSRMLS_CC);
|
||||
zend_raise_conversion_error_ex("could not encode Unicode string", conv, ZEND_FROM_UNICODE, offset TSRMLS_CC);
|
||||
efree(dest);
|
||||
ucnv_close(conv);
|
||||
RETURN_FALSE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue