stasThu Aug 21 18:10:49 2008 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/json/tests bug43941.phpt
Modified files:
/php-src/ext/json json.c utf8_to_utf16.c
Log:
merge fix for #43941
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.21r2=1.9.2.22diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.21 php-src/ext/json/json.c:1.9.2.22
--- php-src/ext/json/json.c:1.9.2.21Mon Dec 31 07:20:07 2007
+++ php-src/ext/json/json.c Thu Aug 21 18:10:48 2008
@@ -16,7 +16,7 @@
+--+
*/
-/* $Id: json.c,v 1.9.2.21 2007/12/31 07:20:07 sebastian Exp $ */
+/* $Id: json.c,v 1.9.2.22 2008/08/21 18:10:48 stas Exp $ */
#ifdef HAVE_CONFIG_H
#include config.h
@@ -251,8 +251,14 @@
{
efree(utf16);
}
-
-smart_str_appendl(buf, \\, 2);
+ if(len 0) {
+ if(!PG(display_errors)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid
UTF-8 sequence in argument);
+ }
+ smart_str_appendl(buf, null, 4);
+ } else {
+ smart_str_appendl(buf, \\, 2);
+ }
return;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/json/utf8_to_utf16.c?r1=1.1r2=1.1.2.1diff_format=u
Index: php-src/ext/json/utf8_to_utf16.c
diff -u php-src/ext/json/utf8_to_utf16.c:1.1
php-src/ext/json/utf8_to_utf16.c:1.1.2.1
--- php-src/ext/json/utf8_to_utf16.c:1.1Tue Jan 31 08:59:06 2006
+++ php-src/ext/json/utf8_to_utf16.cThu Aug 21 18:10:48 2008
@@ -40,7 +40,7 @@
for (;;) {
c = utf8_decode_next(utf8);
if (c 0) {
-return UTF8_END ? the_index : UTF8_ERROR;
+return (c == UTF8_END) ? the_index : UTF8_ERROR;
}
if (c 0x1) {
w[the_index] = (unsigned short)c;
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug43941.phpt?view=markuprev=1.1
Index: php-src/ext/json/tests/bug43941.phpt
+++ php-src/ext/json/tests/bug43941.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php