File tree 3 files changed +45
-0
lines changed
3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1
1
PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? Apr 2007, PHP 5.2.2RC2
4
+ - Fixed bug #41093 (magic_quotes_gpc ignores first arrays keys). (Arpad, Ilia)
4
5
- Fixed bug #41083 (mysql_ping() requires MYSQL_OPT_RECONNECT to be set since
5
6
MySQL 5.0.13). (xiaojb at gmail dot com, Tony)
6
7
- Fixed bug #41075 (memleak when creating default object caused exception).
7
8
(Dmitry)
9
+ - Fixed bug #41067 (json_encode() problem with UTF-16 input). (jp at df5ea
10
+ dot net. Ilia)
8
11
- Fixed bug #41063 (chdir doesn't like root paths). (Dmitry)
9
12
- Fixed bug #41061 ("visibility error" in ReflectionFunction::export()).
10
13
(Johannes)
Original file line number Diff line number Diff line change @@ -316,6 +316,25 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16)
316
316
smart_str_appendc (buf , 0xc0 | (utf16 >> 6 ));
317
317
smart_str_appendc (buf , 0x80 | (utf16 & 0x3f ));
318
318
}
319
+ else if ((utf16 & 0xfc00 ) == 0xdc00
320
+ && buf -> len >= 3
321
+ && ((unsigned char ) buf -> c [buf -> len - 3 ]) == 0xed
322
+ && ((unsigned char ) buf -> c [buf -> len - 2 ] & 0xf0 ) == 0xa0
323
+ && ((unsigned char ) buf -> c [buf -> len - 1 ] & 0xc0 ) == 0x80 )
324
+ {
325
+ /* found surrogate pair */
326
+ unsigned long utf32 ;
327
+
328
+ utf32 = (((buf -> c [buf -> len - 2 ] & 0xf ) << 16 )
329
+ | ((buf -> c [buf -> len - 1 ] & 0x3f ) << 10 )
330
+ | (utf16 & 0x3ff )) + 0x10000 ;
331
+ buf -> len -= 3 ;
332
+
333
+ smart_str_appendc (buf , 0xf0 | (utf32 >> 18 ));
334
+ smart_str_appendc (buf , 0x80 | ((utf32 >> 12 ) & 0x3f ));
335
+ smart_str_appendc (buf , 0x80 | ((utf32 >> 6 ) & 0x3f ));
336
+ smart_str_appendc (buf , 0x80 | (utf32 & 0x3f ));
337
+ }
319
338
else
320
339
{
321
340
smart_str_appendc (buf , 0xe0 | (utf16 >> 12 ));
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #41067 (json_encode() problem with UTF-16 input)
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded ("json " )) print "skip " ; ?>
5
+ --FILE--
6
+ <?php
7
+ $ single_barline = "\360\235\204\200" ;
8
+ $ array = array ($ single_barline );
9
+ print bin2hex ($ single_barline ) . "\n" ;
10
+ // print $single_barline . "\n\n";
11
+ $ json = json_encode ($ array );
12
+ print $ json . "\n\n" ;
13
+ $ json_decoded = json_decode ($ json , true );
14
+ // print $json_decoded[0] . "\n";
15
+ print bin2hex ($ json_decoded [0 ]) . "\n" ;
16
+ print "END \n" ;
17
+ ?>
18
+ --EXPECT--
19
+ f09d8480
20
+ ["\ud834\udd00"]
21
+
22
+ f09d8480
23
+ END
You can’t perform that action at this time.
0 commit comments