Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/json json.c utf8_to_utf16.c /ext/json/tests bug43941.phpt

2008-08-22 Thread Ilia Alshanetsky
Why do we need this check here, wouldn't it already be executed by the  
internal error handler?



On 21-Aug-08, at 2:10 PM, Stanislav Malyshev wrote:


if(!PG(display_errors)) {


Ilia Alshanetsky





--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/json json.c utf8_to_utf16.c /ext/json/tests bug43941.phpt

2008-08-22 Thread Stanislav Malyshev

Hi!

Why do we need this check here, wouldn't it already be executed by the 
internal error handler?


IIRC, it plays kind of opposite to what happens to the error handler - 
if display_errors is on, nothing is printed, in order not to put that 
error message into wrong context. I'm not sure it's that useful, but I 
remember somebody asking for it. My personal opinion is that running 
production server with display_errors=on means one already have shot 
oneself in the foot, but you know. IIRC there are some other places 
which do the same.

--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/json json.c utf8_to_utf16.c /ext/json/tests bug43941.phpt

2008-08-21 Thread Stanislav Malyshev
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