iliaa Mon Apr 16 22:31:05 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/json/tests bug41067.phpt
Modified files:
/php-src NEWS
/php-src/ext/json JSON_parser.c
Log:
Fixed bug #41067 (json_encode() problem with UTF-16 input).
http://cvs.php.net/viewvc.cgi/php-src/NEWS?
r1=1.2027.2.547.2.650&r2=1.2027.2.547.2.651&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.650 php-src/NEWS:
1.2027.2.547.2.651
--- php-src/NEWS:1.2027.2.547.2.650 Sun Apr 15 16:50:41 2007
+++ php-src/NEWS Mon Apr 16 22:31:05 2007
@@ -1,10 +1,13 @@
PHP
NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||
?? Apr 2007, PHP 5.2.2RC2
+- Fixed bug #41093 (magic_quotes_gpc ignores first arrays keys).
(Arpad, Ilia)
- Fixed bug #41083 (mysql_ping() requires MYSQL_OPT_RECONNECT to
be set since
MySQL 5.0.13). (xiaojb at gmail dot com, Tony)
- Fixed bug #41075 (memleak when creating default object caused
exception).
(Dmitry)
+- Fixed bug #41067 (json_encode() problem with UTF-16 input). (jp
at df5ea
+ dot net. Ilia)
- Fixed bug #41063 (chdir doesn't like root paths). (Dmitry)
- Fixed bug #41061 ("visibility error" in
ReflectionFunction::export()).
(Johannes)
http://cvs.php.net/viewvc.cgi/php-src/ext/json/JSON_parser.c?
r1=1.1.2.5&r2=1.1.2.6&diff_format=u
Index: php-src/ext/json/JSON_parser.c
diff -u php-src/ext/json/JSON_parser.c:1.1.2.5 php-src/ext/json/
JSON_parser.c:1.1.2.6
--- php-src/ext/json/JSON_parser.c:1.1.2.5 Fri Apr 13 21:34:12 2007
+++ php-src/ext/json/JSON_parser.c Mon Apr 16 22:31:05 2007
@@ -316,6 +316,25 @@
smart_str_appendc(buf, 0xc0 | (utf16 >> 6));
smart_str_appendc(buf, 0x80 | (utf16 & 0x3f));
}
+ else if ((utf16 & 0xfc00) == 0xdc00
+ && buf->len >= 3
+ && ((unsigned char) buf->c[buf->len - 3]) == 0xed
+ && ((unsigned char) buf->c[buf->len - 2] & 0xf0)
== 0xa0
+ && ((unsigned char) buf->c[buf->len - 1] & 0xc0)
== 0x80)
+ {
+ /* found surrogate pair */
+ unsigned long utf32;
+
+ utf32 = (((buf->c[buf->len - 2] & 0xf) << 16)
+ | ((buf->c[buf->len - 1] & 0x3f) << 10)
+ | (utf16 & 0x3ff)) + 0x10000;
+ buf->len -= 3;
+
+ smart_str_appendc(buf, 0xf0 | (utf32 >> 18));
+ smart_str_appendc(buf, 0x80 | ((utf32 >> 12) & 0x3f));
+ smart_str_appendc(buf, 0x80 | ((utf32 >> 6) & 0x3f));
+ smart_str_appendc(buf, 0x80 | (utf32 & 0x3f));
+ }
else
{
smart_str_appendc(buf, 0xe0 | (utf16 >> 12));
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug41067.phpt?
view=markup&rev=1.1
Index: php-src/ext/json/tests/bug41067.phpt
+++ php-src/ext/json/tests/bug41067.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php