summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2009-02-02 04:54:11 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2009-02-02 04:54:11 +0000
commit90d7d1004c22e6942c1a30f11be65ad25e40d389 (patch)
treeebe3ff9e116c97d693fba3dd11e51b26cec88747
parentf148e5a64f6ee4c9cb1fb70824e1d04507ef7f4a (diff)
downloadphp-git-90d7d1004c22e6942c1a30f11be65ad25e40d389.tar.gz
- MFH: Fix bug #46843 (CP936 euro symbol is not converted properly)
-rw-r--r--NEWS1
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_cp936.c2
-rw-r--r--ext/mbstring/tests/bug46843.phpt12
3 files changed, 14 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 1e97ad3828..ff91db4c6a 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ PHP NEWS
- Fixed bug #46887 (Invalid calls to php_error_docref()).
(oeriksson at mandriva dot com, Ilia)
- Fixed bug #46873 (extract($foo) crashes if $foo['foo'] exists). (Arnaud)
+- Fixed bug #46843 (CP936 euro symbol is not converted properly). (Moriyoshi)
- Fixed bug #46798 (Crash in mssql extension when retrieving a NULL value
inside a binary or image column type). (Ilia)
- Fixed bug #46782 (fastcgi.c parse error). (Matt)
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp936.c b/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
index 9cdd0520e8..561dc3003b 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
@@ -192,7 +192,7 @@ mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter)
}
}
if (s >= 0) {
- if (s < 0x80) { /* latin */
+ if (s <= 0x80) { /* latin */
CK((*filter->output_function)(s, filter->data));
} else {
CK((*filter->output_function)((s >> 8) & 0xff, filter->data));
diff --git a/ext/mbstring/tests/bug46843.phpt b/ext/mbstring/tests/bug46843.phpt
new file mode 100644
index 0000000000..136195cfe0
--- /dev/null
+++ b/ext/mbstring/tests/bug46843.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #46843 (CP936 euro symbol is not converted properly)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+var_dump(bin2hex(mb_convert_encoding("\x80", 'UCS-2BE', 'CP936')));
+var_dump(bin2hex(mb_convert_encoding("\x20\xac", 'CP936', 'UCS-2BE')));
+?>
+--EXPECT--
+string(4) "20ac"
+string(2) "80"