Skip to content

Commit

Permalink
missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Aug 29, 2023
1 parent ed46801 commit 6cf0d1b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/gh29.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
GH issue #29 Segmentation fault with ISO-2022-JP Subject header
--SKIPIF--
<?php
if (!extension_loaded("mailparse")) die("skip mailparse extension not available");
?>
--FILE--
<?php

$data = <<<'EOF'
From: [email protected]
To: [email protected]
Subject: $B%X%C%@$"$j(B
Content-type: text/plain; charset=ISO-2022-JP
Content-transfer-encoding: 7bit
$B$*Hh$lMM$G$9!"%F%9%H%a!<%k$G$9!#(B
$B0J>e!"$h$m$7$/$*4j$$CW$7$^$9!#(B
EOF;

$resource = mailparse_msg_create();

$r = mailparse_msg_parse($resource, $data);
echo 'ok', PHP_EOL;

mailparse_msg_free($resource);

exit(0);
?>
--EXPECTF--
ok
34 changes: 34 additions & 0 deletions tests/gh30.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--TEST--
GH issue #30 Segmentation fault with UTF-8 encoded X-MS-Iris-MetaData header
--SKIPIF--
<?php
if (!extension_loaded("mailparse")) die("skip mailparse extension not available");
?>
--FILE--
<?php

$data = <<<'EOF'
From: [email protected]
To: [email protected]
Subject: Test
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-MS-Iris-MetaData: =?utf-8?q?{=22Type=22=3Anull=2C=22Fields=22=3A{=22InstanceId=22=3A=2290232a75aacb417581ef2a67?=
=?utf-8?q?0087e515=3A2=22=2C=22Market=22=3A=22en-gb=22=2C=22TopicId=22=3A=2220d3416a-aa91-4e58-a5?=
=?utf-8?q?bc-4a2be2a64934=22=2C=22Timestamp=22=3A=228=2F13=2F2023?= 6:01:40
AM"}}
Test
EOF;

$resource = mailparse_msg_create();

$r = mailparse_msg_parse($resource, $data);
echo 'ok', PHP_EOL;

mailparse_msg_free($resource);

exit(0);
?>
--EXPECTF--
ok

0 comments on commit 6cf0d1b

Please sign in to comment.