defined using reflection API. (Johannes)
- Added second optional parameter to stream_context_create() to set params
during context creation. (Sara)
-- Fixed bug #36840 (Memory leak if cast operator throws an exception that is
- caught). (Dmitry)
- Fixed bug #36630 (umask not reset at the end of the request). (Ilia)
- Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus)
ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC)
{
UErrorCode status = U_ZERO_ERROR;
- int retval = TRUE;
char *s = NULL;
int s_len;
int num_conv;
if (U_FAILURE(status)) {
int32_t offset = u_countChar32(u, num_conv);
- /* XXX needs to be fixed, but a leak is better than invalid memory
+ zend_raise_conversion_error_ex("Could not convert Unicode string to binary string", conv, ZEND_FROM_UNICODE, offset, (UG(from_error_mode) & ZEND_CONV_ERROR_EXCEPTION) TSRMLS_CC);
if (s) {
efree(s);
}
- */
- zend_raise_conversion_error_ex("Could not convert Unicode string to binary string", conv, ZEND_FROM_UNICODE, offset, (UG(from_error_mode) & ZEND_CONV_ERROR_EXCEPTION) TSRMLS_CC);
- retval = FAILURE;
+ ZVAL_EMPTY_STRING(string);
+ efree((UChar*)u);
+ return FAILURE;
+ } else {
+ ZVAL_STRINGL(string, s, s_len, 0);
+ efree((UChar*)u);
+ return SUCCESS;
}
-
- ZVAL_STRINGL(string, s, s_len, 0);
-
- efree((UChar*)u);
- return retval;
}
/* }}} */
if (U_FAILURE(status)) {
zend_raise_conversion_error_ex("Could not convert binary string to Unicode string", conv, ZEND_TO_UNICODE, num_conv, (UG(to_error_mode) & ZEND_CONV_ERROR_EXCEPTION) TSRMLS_CC);
- retval = FALSE;
+ if (u) {
+ efree(u);
+ }
+ ZVAL_EMPTY_UNICODE(string);
+ efree(s);
+ return FAILURE;
+ } else {
+ ZVAL_UNICODEL(string, u, u_len, 0);
+ efree(s);
+ return SUCCESS;
}
-
- ZVAL_UNICODEL(string, u, u_len, 0);
-
- efree(s);
- return retval;
}
/* }}} */