Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/iconv/iconv.c trunk/ext/iconv/iconv.c

2010-08-22 Thread Ilia Alshanetsky
Thanks, I just applied a fix for that.

On Thu, Aug 19, 2010 at 9:56 AM, Kalle Sommer Nielsen ka...@php.net wrote:
 Hi Ilia

 2010/8/19 Ilia Alshanetsky il...@php.net:

 -       php_output_handler_alias_register(ZEND_STRL(ob_iconv_handler), 
 php_iconv_output_handler_init TSRMLS_CC);
 +       php_output_handler_alias_register(ZEND_STRL(ob_iconv_handlerÂ), 
 php_iconv_output_handler_init TSRMLS_CC);
        php_output_handler_conflict_register(ZEND_STRL(ob_iconv_handler), 
 php_iconv_output_conflict TSRMLS_CC);

 This doesn't look correct, or is it just me?

 --
 regards,

 Kalle Sommer Nielsen
 ka...@php.net


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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/iconv/iconv.c trunk/ext/iconv/iconv.c

2010-08-19 Thread Ilia Alshanetsky
iliaaThu, 19 Aug 2010 12:27:13 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302476

Log:
Fixed bug #52599 (iconv output handler outputs incorrect content type when 
flags are used).

Bug: http://bugs.php.net/52599 (Open) iconv output handler produces 
Content-Type: text/html; charset=UTF-8//TRANSLIT
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/iconv/iconv.c
U   php/php-src/trunk/ext/iconv/iconv.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-08-19 11:47:00 UTC (rev 302475)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-08-19 12:27:13 UTC (rev 302476)
@@ -16,6 +16,8 @@
 - Fixed bug #52636 (php_mysql_fetch_hash writes long value into int).
   (Kalle, rein at basefarm dot no)
 - Fixed bug #52613 (crash in mysqlnd after hitting memory limit). (Andrey)
+- Fixed bug #52599 (iconv output handler outputs incorrect content type
+  when flags are used). (Ilia)
 - Fixed bug #52573 (SplFileObject::fscanf Segmentation fault). (Felipe)
 - Fixed bug #52546 (pdo_dblib segmentation fault when iterating MONEY values).
   (Felipe)

Modified: php/php-src/branches/PHP_5_3/ext/iconv/iconv.c
===
--- php/php-src/branches/PHP_5_3/ext/iconv/iconv.c  2010-08-19 11:47:00 UTC 
(rev 302475)
+++ php/php-src/branches/PHP_5_3/ext/iconv/iconv.c  2010-08-19 12:27:13 UTC 
(rev 302476)
@@ -2340,7 +2340,13 @@
ICONVG(output_encoding), 
ICONVG(internal_encoding));
_php_iconv_show_error(err, ICONVG(output_encoding), 
ICONVG(internal_encoding) TSRMLS_CC);
if (out_buffer != NULL) {
-   int len = spprintf(content_type, 0, Content-Type:%s; 
charset=%s, mimetype, ICONVG(output_encoding));
+   int len;
+   char *p = strstr(ICONVG(output_encoding), //);
+   if (p) {
+   len = spprintf(content_type, 0, 
Content-Type:%s; charset=%.*s, mimetype, (int)(p - ICONVG(output_encoding)), 
ICONVG(output_encoding));
+   } else {
+   len = spprintf(content_type, 0, 
Content-Type:%s; charset=%s, mimetype, ICONVG(output_encoding));
+   }
if (content_type  sapi_add_header(content_type, len, 
0) != FAILURE) {
SG(sapi_headers).send_default_content_type = 0;
}

Modified: php/php-src/trunk/ext/iconv/iconv.c
===
--- php/php-src/trunk/ext/iconv/iconv.c 2010-08-19 11:47:00 UTC (rev 302475)
+++ php/php-src/trunk/ext/iconv/iconv.c 2010-08-19 12:27:13 UTC (rev 302476)
@@ -276,7 +276,7 @@
return FAILURE;
}

-   php_output_handler_alias_register(ZEND_STRL(ob_iconv_handler), 
php_iconv_output_handler_init TSRMLS_CC);
+   php_output_handler_alias_register(ZEND_STRL(ob_iconv_handler�), 
php_iconv_output_handler_init TSRMLS_CC);
php_output_handler_conflict_register(ZEND_STRL(ob_iconv_handler), 
php_iconv_output_conflict TSRMLS_CC);

return SUCCESS;
@@ -353,7 +353,14 @@
}

if (mimetype != NULL  !(output_context-op  
PHP_OUTPUT_HANDLER_CLEAN)) {
-   int len = spprintf(content_type, 0, Content-Type: 
%.*s; charset=%s, mimetype_len?mimetype_len:strlen(mimetype), mimetype, 
ICONVG(output_encoding));
+   int len;
+   char *p = strstr(ICONVG(output_encoding), //);
+
+   if (p) {
+   len = spprintf(content_type, 0, 
Content-Type:%.*s; charset=%.*s, mimetype_len ? mimetype_len : (int) 
strlen(mimetype), mimetype, (int)(p - ICONVG(output_encoding)), 
ICONVG(output_encoding));
+   } else {
+   len = spprintf(content_type, 0, 
Content-Type:%.*s; charset=%s, mimetype_len ? mimetype_len : (int) 
strlen(mimetype), mimetype, ICONVG(output_encoding));
+   }
if (content_type  SUCCESS == 
sapi_add_header(content_type, len, 0)) {
SG(sapi_headers).send_default_content_type = 0;

php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);

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