1--TEST--
2Bug #35669 (imap_mail_compose() crashes with multipart-multiboundary-email)
3--SKIPIF--
4<?php
5extension_loaded('imap') or die('skip imap extension not available in this build');
6?>
7--FILE--
8<?php
9$envelope["from"] = 'Santa <somewhere@northpole.gov>';
10$envelope["to"]  = 'The bad smurf <bad@smurf.com>';
11$envelope['date'] = 'Wed, 04 Jan 2006 19:24:43 -0500';
12
13$multipart["type"] = TYPEMULTIPART;
14$multipart["subtype"] = "MIXED";
15$body[] = $multipart; //add multipart stuff
16
17$textpart["type"] = TYPEMULTIPART;
18$textpart["subtype"] = "ALTERNATIVE";
19$body[] = $textpart; //add body part
20
21$plain["type"] = TYPETEXT;
22$plain["subtype"] = "PLAIN";
23$plain["charset"] = "iso-8859-1";
24$plain["encoding"] = ENCQUOTEDPRINTABLE;
25$plain["description"] = "Plaintype part of message";
26$plain['disposition'] = "inline";
27$plain["contents.data"] = 'See mom, it will crash';
28
29$body[] = $plain; //next add plain text part
30
31$html["type"] = TYPETEXT;
32$html["subtype"] = "HTML";
33$html["charset"] = "iso-8859-1";
34$html["encoding"] = ENCQUOTEDPRINTABLE;
35$html["description"] = "HTML part of message";
36$html['disposition'] = "inline";
37$html["contents.data"] = 'See mom, it will <b>crash</b>';
38
39$body[] = $html;
40
41echo imap_mail_compose($envelope, $body);
42?>
43--EXPECTF--
44Date: Wed, 04 Jan 2006 19:24:43 -0500
45From: Santa <somewhere@northpole.gov>
46To: The bad smurf <bad@smurf.com>
47MIME-Version: 1.0
48Content-Type: MULTIPART/MIXED; BOUNDARY="%s"
49
50--%s
51Content-Type: TEXT/ALTERNATIVE; CHARSET=US-ASCII
52
53
54--%s
55Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
56Content-Transfer-Encoding: QUOTED-PRINTABLE
57Content-Description: Plaintype part of message
58
59See mom, it will crash
60--%s
61Content-Type: TEXT/HTML; CHARSET=iso-8859-1
62Content-Transfer-Encoding: QUOTED-PRINTABLE
63Content-Description: HTML part of message
64
65See mom, it will <b>crash</b>
66--%s--
67