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

This commit is contained in:
Ilia Alshanetsky 2010-08-19 12:27:13 +00:00
parent 0b1477a716
commit 06c460c995
2 changed files with 9 additions and 1 deletions

2
NEWS
View File

@ -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)

View File

@ -2340,7 +2340,13 @@ PHP_FUNCTION(ob_iconv_handler)
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;
}