File: bug73110.phpt

package info (click to toggle)
php-mailparse 3.1.4%2B2.1.7~dev20160128-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,484 kB
  • sloc: ansic: 4,080; xml: 363; php: 38; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
Bug #73110 (Mails with unknown MIME version are treated as plain/text)
--SKIPIF--
<?php
if (!extension_loaded("mailparse")) die("skip mailparse extension not available");
?>
--FILE--
<?php
$text = 'Mime-Version: 1.0;
Content-Type: multipart/Alternative; boundary="=====1473780076CSSSMTP_CLIENT=="

--=====1473780076CSSSMTP_CLIENT==
Content-Type: text/plain

Hello please pay attached invoice
--=====1473780076CSSSMTP_CLIENT==
Content-Type: text/html; charset=utf-8

Hello please pay attached invoice

--=====1473780076CSSSMTP_CLIENT==--';
$stream = fopen('php://memory', 'r+');
fwrite($stream, $text);
fseek($stream, 0);
$resource = mailparse_msg_create();
mailparse_msg_parse($resource, fread($stream, 10000));
$data = mailparse_msg_get_part_data(mailparse_msg_get_part($resource, 1));
var_dump($data['content-type']);
mailparse_msg_free($resource);
?>
--EXPECT--
string(21) "multipart/alternative"