cvs: ZendEngine2 / zend_unicode.c php-src NEWS

From: Date: Mon, 27 Mar 2006 07:35:05 +0000
Subject: cvs: ZendEngine2 / zend_unicode.c php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4772@lists.php.net to get a copy of this message
dmitry Mon Mar 27 07:35:05 2006 UTC Modified files: /php-src NEWS /ZendEngine2 zend_unicode.c Log: Better but incomplete fix for bug #36840 http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2110&r2=1.2111&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2110 php-src/NEWS:1.2111 --- php-src/NEWS:1.2110 Sun Mar 26 04:40:11 2006 +++ php-src/NEWS Mon Mar 27 07:35:05 2006 @@ -45,7 +45,5 @@ 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) http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.c?r1=1.18&r2=1.19&diff_format=u Index: ZendEngine2/zend_unicode.c diff -u ZendEngine2/zend_unicode.c:1.18 ZendEngine2/zend_unicode.c:1.19 --- ZendEngine2/zend_unicode.c:1.18 Mon Mar 27 06:02:28 2006 +++ ZendEngine2/zend_unicode.c Mon Mar 27 07:35:05 2006 @@ -442,7 +442,6 @@ 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; @@ -455,19 +454,18 @@ 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; } /* }}} */ @@ -486,13 +484,17 @@ 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; } /* }}} */

« previous php.zend-engine.cvs (#4772) next »