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