summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-08-19 12:27:13 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-08-19 12:27:13 +0000
commit06c460c9954127323a1faf15f51981a25815aacc (patch)
treec37ee188341275d7b23558b5f110880371187940 /ext/iconv
parent0b1477a716afb5cf1606ba89edff045fea1a13de (diff)
downloadphp-git-06c460c9954127323a1faf15f51981a25815aacc.tar.gz
Fixed bug #52599 (iconv output handler outputs incorrect content type when flags are used).
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/iconv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 7f90d6df5d..0b9c60fa17 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -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;
}