File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / iconv / tests / bug52941.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:56 2012 UTC (12 years, 10 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #52941 (The 'iconv_mime_decode_headers' function is skipping headers)
--SKIPIF--
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
--FILE--
<?php
$headers = <<<HEADERS
From: =?UTF-8?B?PGZvb0BleGFtcGxlLmNvbT4=?=
Subject: =?ks_c_5601-1987?B?UkU6odk=?=
X-Foo: =?ks_c_5601-1987?B?UkU6odk=?= Foo
X-Bar: =?ks_c_5601-1987?B?UkU6odk=?= =?UTF-8?Q?Foo?=
To: <test@example.com>
HEADERS;

$decoded = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');

var_dump($decoded['From']);
var_dump($decoded['Subject']);
var_dump($decoded['X-Foo']);
var_dump($decoded['X-Bar']);
var_dump($decoded['To']);

$decoded = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR | ICONV_MIME_DECODE_STRICT, 'UTF-8');

var_dump($decoded['From']);
var_dump($decoded['Subject']);
var_dump($decoded['X-Foo']);
var_dump($decoded['X-Bar']);
var_dump($decoded['To']);
?>
--EXPECTF--
string(17) "<foo@example.com>"
string(%d) "%s"
string(%d) "%sFoo"
string(%d) "%sFoo"
string(18) "<test@example.com>"
string(17) "<foo@example.com>"
string(%d) "%s"
string(%d) "%sFoo"
string(%d) "%sFoo"
string(18) "<test@example.com>"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>