bug35669.phpt 2.1 KB

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