2 /* Prototype : array iconv_mime_decode_headers(string headers [, int mode, string charset])
3 * Description: Decodes multiple mime header fields
4 * Source code: ext/iconv/iconv.c
8 * Pass different data types to $str argument to see how iconv_mime_decode_headers() behaves
11 echo "*** Testing iconv_mime_decode_headers() : usage variations ***\n";
13 // Some of the parameters actually passed to charset will request to use
14 // a default charset determined by the platform. In order for this test to
15 // run on both linux and windows, the subject will have to be ascii only.
16 // Initialise function arguments not being substituted
18 Subject: =?UTF-8?B?QSBTYW1wbGUgVGVzdA==?=
19 To: example@example.com
20 Date: Thu, 1 Jan 1970 00:00:00 +0000
21 Message-Id: <example@example.com>
22 Received: from localhost (localhost [127.0.0.1]) by localhost
23 with SMTP id example for <example@example.com>;
24 Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
25 (envelope-from example-return-0000-example=example.com@example.com)
26 Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
30 $mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR
;
34 //get an unset variable
41 public function __toString() {
42 return "Class A object";
51 // get a resource variable
52 $fp = fopen(__FILE__
, "r");
54 // unexpected values to be passed to $str argument
93 /*22*/ @$undefined_var,
102 // loop through each element of $inputs to check the behavior of iconv_mime_decode_headers()
104 foreach($inputs as $input) {
105 echo "\n-- Iteration $iterator --\n";
106 try { var_dump( iconv_mime_decode_headers($headers, $input, $charset)); } catch (Exception
$e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__
.' on line '.__LINE__
."\n"; }