cvs: ZendEngine2 / zend_exceptions.c
| From: | Andrei Zmievski | Date: | Mon, 27 Mar 2006 03:47:50 +0000 |
| Subject: | cvs: ZendEngine2 / zend_exceptions.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4770@lists.php.net to get a copy of this message | ||
andrei Mon Mar 27 03:47:50 2006 UTC
Modified files:
/ZendEngine2 zend_exceptions.c
Log:
Fix a case where we could have an encoding conversion exception thrown
while building exception trace args!
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_exceptions.c?r1=1.102&r2=1.103&diff_format=u
Index: ZendEngine2/zend_exceptions.c
diff -u ZendEngine2/zend_exceptions.c:1.102 ZendEngine2/zend_exceptions.c:1.103
--- ZendEngine2/zend_exceptions.c:1.102 Mon Mar 27 03:41:39 2006
+++ ZendEngine2/zend_exceptions.c Mon Mar 27 03:47:50 2006
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_exceptions.c,v 1.102 2006/03/27 03:41:39 andrei Exp $ */
+/* $Id: zend_exceptions.c,v 1.103 2006/03/27 03:47:50 andrei Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -385,6 +385,13 @@
}
case IS_UNICODE: {
int l_added;
+ /*
+ * We do not want to apply current error mode here, since
+ * zend_make_printable_zval() uses output encoding converter.
+ * Temporarily set output encoding converter to escape offending
+ * chars with \uXXXX notation.
+ */
+ zend_set_converter_error_mode(ZEND_U_CONVERTER(UG(output_encoding_conv)), ZEND_FROM_UNICODE,
ZEND_CONV_ERROR_ESCAPE_JAVA);
TRACE_APPEND_CHR('\'');
if (Z_USTRLEN_PP(arg) > 15) {
TRACE_APPEND_USTRL(Z_USTRVAL_PP(arg), 15);
@@ -396,6 +403,10 @@
TRACE_APPEND_STR("', ");
l_added += 3 + 1;
}
+ /*
+ * Reset output encoding converter error mode.
+ */
+ zend_set_converter_error_mode(ZEND_U_CONVERTER(UG(output_encoding_conv)), ZEND_FROM_UNICODE,
UG(from_error_mode));
while (--l_added) {
if ((unsigned char)(*str)[*len - l_added] < 32) {
(*str)[*len - l_added] = '?';