From b882f9f37e335e08bcc523cb1d6c90ed59544638 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 25 May 2006 22:54:16 +0000 Subject: [PATCH] Fixed bug #37569 (WDDX incorrectly encodes high-ascii characters) --- NEWS | 1 + ext/wddx/tests/bug37569.phpt | 10 ++++++++++ ext/wddx/wddx.c | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 ext/wddx/tests/bug37569.phpt diff --git a/NEWS b/NEWS index 171e210e25..a8460b9ba5 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,7 @@ PHP NEWS - Added RFC2397 (data: stream) support. (Marcus) - Fixed handling of extremely long paths inside tempnam() function. (Ilia) - Fixed bug #37587 (var without attribute causes segfault). (Marcus) +- Fixed bug #37569 (WDDX incorrectly encodes high-ascii characters). (Ilia) - Fixed bug #37565 (Using reflection::export with simplexml causing a crash). (Marcus) - Fixed bug #37563 (array_key_exists performance is poor for &$array). (Ilia) diff --git a/ext/wddx/tests/bug37569.phpt b/ext/wddx/tests/bug37569.phpt new file mode 100755 index 0000000000..f741d7b029 --- /dev/null +++ b/ext/wddx/tests/bug37569.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #37569 (WDDX incorrectly encodes high-ascii characters) +--FILE-- + +--EXPECT-- +
+
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 76b136a63b..410f8378d8 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -399,9 +399,9 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var) break; default: - if (iscntrl((int)*(unsigned char *)p)) { + if (iscntrl((int)*(unsigned char *)p) || (int)*(unsigned char *)p >= 127) { FLUSH_BUF(); - sprintf(control_buf, WDDX_CHAR, *p); + sprintf(control_buf, WDDX_CHAR, (int)*(unsigned char *)p); php_wddx_add_chunk(packet, control_buf); } else buf[l++] = *p; -- 2.50.1