cvs: pear /PECL/mailparse mailparse.c php_mailparse_mime.c /PECL/mailparse/tests parse_test_messages.phpt /PECL/mailparse/tests/testdata mime.exp
mime.txt multimedia-demo.exp multimedia-demo.txt.gz phpcvs1.exp phpcvs1.txt qp.exp qp.txt uue.exp uue.txt
| From: | Wez Furlong | Date: | Tue, 19 Nov 2002 18:40:09 +0000 |
| Subject: | cvs: pear /PECL/mailparse mailparse.c php_mailparse_mime.c /PECL/mailparse/tests parse_test_messages.phpt /PECL/mailparse/tests/testdata mime.exp mime.txt multimedia-demo.exp multimedia-demo.txt.gz phpcvs1.exp phpcvs1.txt qp.exp qp.txt uue.exp uue.txt |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7497@lists.php.net to get a copy of this message | ||
wez Tue Nov 19 13:40:09 2002 EDT
Added files:
/pear/PECL/mailparse/tests parse_test_messages.phpt
/pear/PECL/mailparse/tests/testdata mime.exp mime.txt
multimedia-demo.exp
multimedia-demo.txt.gz
phpcvs1.exp phpcvs1.txt qp.exp
qp.txt uue.exp uue.txt
Modified files:
/pear/PECL/mailparse mailparse.c php_mailparse_mime.c
Log:
Fix remaining known problems.
Add some test data, some of which was borrowed from pine.
Index: pear/PECL/mailparse/mailparse.c diff -u pear/PECL/mailparse/mailparse.c:1.34 pear/PECL/mailparse/mailparse.c:1.35 --- pear/PECL/mailparse/mailparse.c:1.34 Tue Nov 19 07:36:13 2002 +++ pear/PECL/mailparse/mailparse.c Tue Nov 19 13:40:07 2002 @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: mailparse.c,v 1.34 2002/11/19 12:36:13 wez Exp $ */ +/* $Id: mailparse.c,v 1.35 2002/11/19 18:40:07 wez Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -651,7 +651,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "mailparse support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.34 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.35 $"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -1364,10 +1364,7 @@ zend_hash_get_current_key_ex(Z_ARRVAL_P(attr->attributes), &key, &key_len, NULL, 0, &pos); - newkey = emalloc(key_len + pref_len + 1); - strcpy(newkey, attrprefix); - strcat(newkey, key); - + spprintf(&newkey, 0, "%s%s", attrprefix, key); add_assoc_string(return_value, newkey, Z_STRVAL_PP(val), 1); efree(newkey); @@ -1388,10 +1385,19 @@ static void add_header_reference_to_zval(char *headerkey, zval *return_value, zval *headers TSRMLS_DC) { zval **headerval; + zval *newhdr; if (SUCCESS == zend_hash_find(Z_ARRVAL_P(headers), headerkey, strlen(headerkey)+1, (void**)&headerval)) { +#if 1 + MAKE_STD_ZVAL(newhdr); + *newhdr = **headerval; + INIT_PZVAL(newhdr); + zval_copy_ctor(newhdr); + zend_hash_update(Z_ARRVAL_P(return_value), headerkey, strlen(headerkey)+1, (void**)&newhdr, sizeof(zval *), NULL); +#else ZVAL_ADDREF(*headerval); zend_hash_update(Z_ARRVAL_P(return_value), headerkey, strlen(headerkey)+1, (void**)headerval, sizeof(zval *), NULL); +#endif } } @@ -1423,7 +1429,7 @@ if (part->charset) add_assoc_string(return_value, "charset", part->charset, 1); else - add_assoc_string(return_value, "charset", "us-ascii", 1); + add_assoc_string(return_value, "charset", MAILPARSEG(def_charset), 1); if (part->content_transfer_encoding) add_assoc_string(return_value, "transfer-encoding", part->content_transfer_encoding, 1); @@ -1432,6 +1438,8 @@ if (part->content_type) add_attr_header_to_zval("content-type", "content-", return_value, part->content_type TSRMLS_CC); + else + add_assoc_string(return_value, "content-type", "text/plain; (error)", 1); if (part->content_disposition) add_attr_header_to_zval("content-disposition", "disposition-", return_value, part->content_disposition TSRMLS_CC); Index: pear/PECL/mailparse/php_mailparse_mime.c diff -u pear/PECL/mailparse/php_mailparse_mime.c:1.9 pear/PECL/mailparse/php_mailparse_mime.c:1.10 --- pear/PECL/mailparse/php_mailparse_mime.c:1.9 Tue Nov 19 07:36:14 2002 +++ pear/PECL/mailparse/php_mailparse_mime.c Tue Nov 19 13:40:07 2002 @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_mailparse_mime.c,v 1.9 2002/11/19 12:36:14 wez Exp $ */ +/* $Id: php_mailparse_mime.c,v 1.10 2002/11/19 18:40:07 wez Exp $ */ #include "php.h" #include "php_mailparse.h" @@ -24,7 +24,7 @@ #define MAXLEVELS 20 #define MAXPARTS 300 -#define IS_MIME_1(part) ((part)->mime_version && strcmp("1.0", (part)->mime_version) == 0) +#define IS_MIME_1(part) (((part)->mime_version && strcmp("1.0", (part)->mime_version) == 0) || ((part)->parent)) #define CONTENT_TYPE_IS(part, contenttypevalue) ((part)->content_type && strcasecmp((part)->content_type->value, contenttypevalue) == 0) #define CONTENT_TYPE_ISL(part, contenttypevalue, len) ((part)->content_type && strncasecmp((part)->content_type->value, contenttypevalue, len) == 0) @@ -175,11 +175,14 @@ STR_FREE(part->mime_version); STR_FREE(part->content_transfer_encoding); STR_FREE(part->charset); + STR_FREE(part->boundary); STR_FREE(part->content_base); STR_FREE(part->content_location); - if (part->content_type) + if (part->content_type) { php_mimeheader_free(part->content_type); + part->content_type = NULL; + } if (part->content_disposition) php_mimeheader_free(part->content_disposition); @@ -286,13 +289,19 @@ if (strcmp(header_key, "content-transfer-encoding") == 0) STR_SET_REPLACE(part->content_transfer_encoding, header_val_stripped); if (strcmp(header_key, "content-type") == 0) { - char *charset; + char *charset, *boundary; - if (part->content_type) + if (part->content_type) { php_mimeheader_free(part->content_type); + part->content_type = NULL; + } part->content_type = php_mimeheader_alloc_from_tok(toks); - part->boundary = php_mimepart_attribute_get(part->content_type, "boundary"); + + boundary = php_mimepart_attribute_get(part->content_type, "boundary"); + if (boundary) { + part->boundary = estrdup(boundary); + } charset = php_mimepart_attribute_get(part->content_type, "charset"); if (charset) { @@ -360,30 +369,27 @@ } } -static int php_mimepart_process_line(php_mimepart *part TSRMLS_DC) +static int php_mimepart_process_line(php_mimepart *workpart TSRMLS_DC) { - php_mimepart *workpart; size_t origcount, linelen; char *c; /* sanity check */ - if (zend_hash_num_elements(&part->children) > MAXPARTS) { + if (zend_hash_num_elements(&workpart->children) > MAXPARTS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "MIME message too complex"); return FAILURE; } - c = part->parsedata.workbuf.c; - smart_str_0(&part->parsedata.workbuf); + c = workpart->parsedata.workbuf.c; + smart_str_0(&workpart->parsedata.workbuf); /* strip trailing \r\n -- we always have a trailing \n */ - origcount = part->parsedata.workbuf.len; + origcount = workpart->parsedata.workbuf.len; linelen = origcount - 1; if (linelen && c[linelen-1] == '\r') --linelen; /* Discover which part we were last working on */ - workpart = part; - while (workpart->parsedata.lastpart) { int bound_len; php_mimepart *lastpart = workpart->parsedata.lastpart; @@ -462,11 +468,18 @@ if (!IS_MIME_1(workpart)) { /* if we don't understand the MIME version, discard the content-type and * boundary */ - if (part->content_type) - php_mimeheader_free(part->content_type); - if (part->content_disposition) - php_mimeheader_free(part->content_disposition); - workpart->boundary = NULL; + if (workpart->content_disposition) { + php_mimeheader_free(workpart->content_disposition); + workpart->content_disposition = NULL; + } + if (workpart->boundary) { + efree(workpart->boundary); + workpart->boundary = NULL; + } + if (workpart->content_type) { + php_mimeheader_free(workpart->content_type); + workpart->content_type = NULL; + } workpart->content_type = php_mimeheader_alloc("text/plain"); } /* if there is no content type, default to text/plain, but use multipart/digest when in Index: pear/PECL/mailparse/tests/parse_test_messages.phpt +++ pear/PECL/mailparse/tests/parse_test_messages.phpt --TEST-- Parse messages in testdata dir --SKIPIF-- <?php /* vim600: sw=4 ts=4 fdm=marker syn=php */ if (!extension_loaded("mailparse")) print "skip"; ?> --FILE-- <?php error_reporting(~E_NOTICE); $define_expect = isset($argv[1]) && $argv[1] == "define_expect"; $testdir = dirname(__FILE__) . "/testdata"; $dir = opendir($testdir) or die("unable to open test dir!"); $messages = array(); while (($f = readdir($dir)) !== false) { if ($f == "CVS" || $f == "." || $f == "..") continue; list($name, $suffix) = explode(".", $f, 2); switch($suffix) { case "txt": case "txt.gz": $messages[$name]["testfile"] = $f; break; case "exp": $messages[$name]["expectfile"] = $f; break; } } if (false) { $messages = array("multimedia-demo" => array("testfile" => "multimedia-demo.txt.gz", "expectfile" => "multimedia-demo.exp")); } if (function_exists("version_compare") && version_compare(phpversion(), "4.3", "ge")) { $wrapper = "compress.zlib://"; } else { /* this section is here because it is useful to compare to the * original implementaion of mailparse for PHP 4.2 */ $wrapper = "zlib:"; function file_get_contents($filename) { $fp = fopen($filename, "rb"); $data = fread($fp, filesize($filename)); fclose($fp); return $data; } } function diff_strings($left, $right) { if (is_executable("/usr/bin/diff")) { $lf = tempnam("/tmp", "mpt"); $rf = tempnam("/tmp", "mpt"); $ok = false; $fp = fopen($lf, "wb"); if ($fp) { fwrite($fp, $left); fclose($fp); $fp = fopen($rf, "wb"); if ($fp) { fwrite($fp, $right); fclose($fp); $ok = true; } } if ($ok) { passthru("/usr/bin/diff -u $lf $rf"); } unlink($lf); unlink($rf); if ($ok) return; } $left = explode("\n", $left); $right = explode("\n", $right); $n = max(count($left), count($right)); $difflines = array(); $runstart = null; $runend = null; for ($i = 0; $i < $n; $i++) { if ($left[$i] != $right[$i]) { if ($runstart === null) { $runstart = $i; $runend = $i; } else { /* part of the run */ $runend = $i; } } else { if ($runstart !== null) { $difflines[] = array($runstart, $runend); $runstart = null; $runend = null; } } } if ($runstart !== null) $difflines[] = array($runstart, $runend); $lastprint = null; foreach ($difflines as $run) { list($start, $end) = $run; $startline = $start - 3; if ($startline < 0) $startline = 0; $endline = $end; if ($lastprint === null) { echo "@@ Line: " . ($startline+1) . "\n"; } else if ($startline <= $lastprint) { $startline = $lastprint+1; } if ($startline > $endline) continue; /* starting context */ for ($i = $startline; $i < $start; $i++) { echo " " . $left[$i] . "\n"; $lastprint = $i; } /* diff run */ for ($i = $start; $i <= $end; $i++) { echo "-" . $left[$i] . "\n"; } for ($i = $start; $i <= $end; $i++) { echo "+" . $right[$i] . "\n"; } $lastprint = $i; } } $skip_keys = array("headers", "ending-pos-body"); foreach ($messages as $name => $msgdata) { $testname = $testdir . "/" . $msgdata["testfile"]; $expectname = $testdir . "/" . $msgdata["expectfile"]; $use_wrapper = substr($testname, -3) == ".gz" ? $wrapper : ""; $fp = fopen("$use_wrapper$testname", "rb") or die("failed to open the file!"); $mime = mailparse_msg_create(); while (!feof($fp)) { $data = fread($fp, 1024); if ($data !== false) mailparse_msg_parse($mime, $data); } fclose($fp); $struct = mailparse_msg_get_structure($mime); ob_start(); echo "Message: $name\n"; foreach($struct as $partname) { $depth = count(explode(".", $partname)) - 1; $indent = str_repeat(" ", $depth * 2); $subpart = mailparse_msg_get_part($mime, $partname); if (!$subpart) { var_dump($struct); break; } $data = mailparse_msg_get_part_data($subpart); echo "\n{$indent}Part $partname\n"; ksort($data); foreach ($data as $key => $value) { if (in_array($key, $skip_keys)) continue; echo "$indent$key => "; var_dump($value); } } $output = ob_get_contents(); if ($define_expect) { $fp = fopen($expectname, "wb"); fwrite($fp, $output); fclose($fp); } else { $expect = file_get_contents($expectname); if ($output != $expect) { ob_end_flush(); diff_strings($expect, $output); die("FAIL!"); } } ob_end_clean(); } echo "All messages parsed OK!"; ?> --EXPECT-- All messages parsed OK! Index: pear/PECL/mailparse/tests/testdata/mime.exp +++ pear/PECL/mailparse/tests/testdata/mime.exp Message: mime Part 1 body-line-count => int(27) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(41) "----=_NextPart_000_0007_01C2566B.DA7C64F0" content-type => string(15) "multipart/mixed" ending-pos => int(1488) line-count => int(47) starting-pos => int(0) starting-pos-body => int(856) transfer-encoding => string(4) "8bit" Part 1.1 body-line-count => int(1) charset => string(8) "us-ascii" content-base => string(1) "/" content-charset => string(8) "us-ascii" content-type => string(10) "text/plain" ending-pos => int(1081) line-count => int(5) starting-pos => int(949) starting-pos-body => int(1032) transfer-encoding => string(4) "7bit" Part 1.2 body-line-count => int(7) charset => string(8) "us-ascii" content-base => string(1) "/" content-disposition => string(10) "attachment" content-name => string(6) "README" content-type => string(24) "application/octet-stream" disposition-filename => string(6) "README" ending-pos => int(1435) line-count => int(13) starting-pos => int(1128) starting-pos-body => int(1286) transfer-encoding => string(16) "quoted-printable" Index: pear/PECL/mailparse/tests/testdata/mime.txt +++ pear/PECL/mailparse/tests/testdata/mime.txt Return-Path: <wez@thebrainroom.com> Received: from TITAN (titan.brainnet.i [192.168.2.7]) by zaneeb.brainnet.i (8.10.2/8.10.2/SuSE Linux 8.10.0-0.3) with ESMTP id g87BfJ721279 for <wez@thebrainroom.com>; Sat, 7 Sep 2002 12:41:19 +0100 X-Authentication-Warning: zaneeb.brainnet.i: Host titan.brainnet.i [192.168.2.7] claimed to be TITAN From: "Wez Furlong" <wez@thebrainroom.com> To: <wez@thebrainroom.com> Subject: mime attach Date: Sat, 7 Sep 2002 12:41:14 +0100 Message-ID: <000601c25663$78b7fcf0$0702a8c0@TITAN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0007_01C2566B.DA7C64F0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-TBR-DestBox: user.wez (auth as wez) (wez:) This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C2566B.DA7C64F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit this is a message with regular mime attachment. ------=_NextPart_000_0007_01C2566B.DA7C64F0 Content-Type: application/octet-stream; name="README" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="README" FooBar - blah blah blah foo bar bar baaaa=0A= =0A= Requirements: =0A= o php with mailparse=0A= o virus scanner (optional)=0A= =0A= =0A= ------=_NextPart_000_0007_01C2566B.DA7C64F0-- Index: pear/PECL/mailparse/tests/testdata/multimedia-demo.exp +++ pear/PECL/mailparse/tests/testdata/multimedia-demo.exp Message: multimedia-demo Part 1 body-line-count => int(25863) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(11) "owatagusiam" content-type => string(15) "multipart/mixed" ending-pos => int(1819395) line-count => int(25876) starting-pos => int(0) starting-pos-body => int(390) transfer-encoding => string(4) "8bit" Part 1.1 body-line-count => int(3) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(11) "Explanation" content-type => string(10) "text/plain" ending-pos => int(650) line-count => int(6) starting-pos => int(404) starting-pos-body => int(463) transfer-encoding => string(4) "8bit" Part 1.2 body-line-count => int(106) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Rich Text demo" content-type => string(14) "message/rfc822" ending-pos => int(5532) line-count => int(109) starting-pos => int(665) starting-pos-body => int(731) transfer-encoding => string(4) "8bit" Part 1.2.1 body-line-count => int(83) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(55) "Interpart_Boundary_AdJn:mu0M2YtJKaFh9AdJn:mu0M2YtJKaFk=" content-type => string(21) "multipart/alternative" ending-pos => int(5532) line-count => int(106) starting-pos => int(731) starting-pos-body => int(1913) transfer-encoding => string(4) "8bit" Part 1.2.1.1 body-line-count => int(16) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(3249) line-count => int(17) starting-pos => int(2497) starting-pos-body => int(2498) transfer-encoding => string(4) "8bit" Part 1.2.1.2 body-line-count => int(19) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(57) "Alternative_Boundary_8dJn:mu0M2Yt5KaFZ8AdJn:mu0M2Yt1KaFdA" content-type => string(15) "multipart/mixed" ending-pos => int(4482) line-count => int(22) starting-pos => int(3308) starting-pos-body => int(3411) transfer-encoding => string(4) "8bit" Part 1.2.1.2.1 body-line-count => int(13) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(13) "text/richtext" ending-pos => int(4418) line-count => int(16) starting-pos => int(3471) starting-pos-body => int(3544) transfer-encoding => string(16) "quoted-printable" Part 1.2.1.3 body-line-count => int(27) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(24) "application/andrew-inset" ending-pos => int(5470) line-count => int(29) starting-pos => int(4540) starting-pos-body => int(4580) transfer-encoding => string(4) "8bit" Part 1.3 body-line-count => int(7605) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(15) "Voice Mail demo" content-type => string(14) "message/rfc822" ending-pos => int(560279) line-count => int(7608) starting-pos => int(5546) starting-pos-body => int(5613) transfer-encoding => string(4) "8bit" Part 1.3.1 body-line-count => int(7586) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(7) "Hi Mark" content-type => string(11) "audio/basic" ending-pos => int(560279) line-count => int(7605) starting-pos => int(5613) starting-pos-body => int(6556) transfer-encoding => string(6) "base64" Part 1.4 body-line-count => int(465) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(11) "Flint phone" content-type => string(11) "audio/basic" ending-pos => int(596156) line-count => int(469) starting-pos => int(560293) starting-pos-body => int(560387) transfer-encoding => string(6) "base64" Part 1.5 body-line-count => int(23) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(11) "MTR's photo" content-type => string(9) "image/pbm" ending-pos => int(598054) line-count => int(27) starting-pos => int(596171) starting-pos-body => int(596263) transfer-encoding => string(6) "base64" Part 1.6 body-line-count => int(4565) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(15) "Star Trek Party" content-type => string(14) "message/rfc822" ending-pos => int(776452) line-count => int(4568) starting-pos => int(598069) starting-pos-body => int(598136) transfer-encoding => string(4) "8bit" Part 1.6.1 body-line-count => int(4532) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(14) "Outermost_Trek" content-type => string(15) "multipart/mixed" ending-pos => int(776452) line-count => int(4565) starting-pos => int(598136) starting-pos-body => int(599956) transfer-encoding => string(4) "8bit" Part 1.6.1.1 body-line-count => int(451) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(28) "Where_No_One_Has_Gone_Before" content-type => string(15) "multipart/mixed" ending-pos => int(631998) line-count => int(453) starting-pos => int(599973) starting-pos-body => int(600042) transfer-encoding => string(4) "8bit" Part 1.6.1.1.1 body-line-count => int(16) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(600789) line-count => int(17) starting-pos => int(600073) starting-pos-body => int(600074) transfer-encoding => string(4) "8bit" Part 1.6.1.1.2 body-line-count => int(426) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "He's dead, Jim" content-type => string(11) "audio/x-sun" ending-pos => int(631964) line-count => int(430) starting-pos => int(600821) starting-pos-body => int(600918) transfer-encoding => string(6) "base64" Part 1.6.1.2 body-line-count => int(3418) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(28) "Where_No_Man_Has_Gone_Before" content-type => string(15) "multipart/mixed" ending-pos => int(729141) line-count => int(3420) starting-pos => int(632015) starting-pos-body => int(632084) transfer-encoding => string(4) "8bit" Part 1.6.1.2.1 body-line-count => int(352) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(16) "Kirk/Spock/McCoy" content-type => string(9) "image/gif" ending-pos => int(657860) line-count => int(356) starting-pos => int(632115) starting-pos-body => int(632212) transfer-encoding => string(6) "base64" Part 1.6.1.2.2 body-line-count => int(253) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(25) "Star Trek Next Generation" content-type => string(9) "image/gif" ending-pos => int(676411) line-count => int(257) starting-pos => int(657892) starting-pos-body => int(657998) transfer-encoding => string(6) "base64" Part 1.6.1.2.3 body-line-count => int(2436) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(17) "application/x-be2" content-version => string(2) "12" ending-pos => int(720176) line-count => int(2438) starting-pos => int(676443) starting-pos-body => int(676487) transfer-encoding => string(4) "8bit" Part 1.6.1.2.4 body-line-count => int(357) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(22) "application/atomicmail" content-version => string(4) "1.12" ending-pos => int(729107) line-count => int(359) starting-pos => int(720208) starting-pos-body => int(720261) transfer-encoding => string(4) "8bit" Part 1.6.1.3 body-line-count => int(647) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Distress calls" content-type => string(11) "audio/x-sun" ending-pos => int(776430) line-count => int(651) starting-pos => int(729158) starting-pos-body => int(729255) transfer-encoding => string(6) "base64" Part 1.7 body-line-count => int(483) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Digitizer test" content-type => string(14) "message/rfc822" ending-pos => int(862163) line-count => int(486) starting-pos => int(776466) starting-pos-body => int(776532) transfer-encoding => string(4) "8bit" Part 1.7.1 body-line-count => int(457) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(24) "mail.sleepy.sau.144.8891" content-type => string(15) "multipart/mixed" ending-pos => int(862163) line-count => int(483) starting-pos => int(776532) starting-pos-body => int(777838) transfer-encoding => string(4) "8bit" Part 1.7.1.1 body-line-count => int(0) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(777887) line-count => int(1) starting-pos => int(777865) starting-pos-body => int(777866) transfer-encoding => string(4) "8bit" Part 1.7.1.2 body-line-count => int(433) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(12) "Bellcore mug" content-type => string(9) "image/pgm" ending-pos => int(861843) line-count => int(439) starting-pos => int(777915) starting-pos-body => int(778102) transfer-encoding => string(6) "base64" Part 1.7.1.3 body-line-count => int(8) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(862131) line-count => int(9) starting-pos => int(861871) starting-pos-body => int(861872) transfer-encoding => string(4) "8bit" Part 1.8 body-line-count => int(431) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(12) "More Imagery" content-type => string(14) "message/rfc822" ending-pos => int(936281) line-count => int(434) starting-pos => int(862177) starting-pos-body => int(862241) transfer-encoding => string(4) "8bit" Part 1.8.1 body-line-count => int(406) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(23) "mail.sleepy.sau.158.532" content-type => string(15) "multipart/mixed" ending-pos => int(936281) line-count => int(431) starting-pos => int(862241) starting-pos-body => int(863504) transfer-encoding => string(4) "8bit" Part 1.8.1.1 body-line-count => int(26) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(864751) line-count => int(27) starting-pos => int(863530) starting-pos-body => int(863531) transfer-encoding => string(4) "8bit" Part 1.8.1.2 body-line-count => int(369) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(23) "Mail architecture slide" content-type => string(9) "image/pbm" ending-pos => int(936251) line-count => int(374) starting-pos => int(864778) starting-pos-body => int(864934) transfer-encoding => string(6) "base64" Part 1.9 body-line-count => int(6438) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(15) "PostScript demo" content-type => string(14) "message/rfc822" ending-pos => int(1327933) line-count => int(6441) starting-pos => int(936295) starting-pos-body => int(936362) transfer-encoding => string(4) "8bit" Part 1.9.1 body-line-count => int(6421) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Captain Picard" content-type => string(22) "application/postscript" ending-pos => int(1327933) line-count => int(6438) starting-pos => int(936362) starting-pos-body => int(937199) transfer-encoding => string(4) "8bit" Part 1.10 body-line-count => int(1015) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(21) "Quoted-Printable test" content-type => string(9) "image/gif" ending-pos => int(1405346) line-count => int(1019) starting-pos => int(1327947) starting-pos-body => int(1328059) transfer-encoding => string(16) "quoted-printable" Part 1.11 body-line-count => int(1382) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(19) "q-p vs. base64 test" content-type => string(14) "message/rfc822" ending-pos => int(1507736) line-count => int(1385) starting-pos => int(1405361) starting-pos-body => int(1405432) transfer-encoding => string(4) "8bit" Part 1.11.1 body-line-count => int(1368) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(8) "hal_9000" content-type => string(15) "multipart/mixed" ending-pos => int(1507736) line-count => int(1382) starting-pos => int(1405432) starting-pos-body => int(1406106) transfer-encoding => string(4) "8bit" Part 1.11.1.1 body-line-count => int(807) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(21) "I'm sorry, Dave (q-p)" content-type => string(11) "audio/basic" ending-pos => int(1467518) line-count => int(811) starting-pos => int(1406117) starting-pos-body => int(1406231) transfer-encoding => string(16) "quoted-printable" Part 1.11.1.2 body-line-count => int(549) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(24) "I'm sorry, Dave (BASE64)" content-type => string(11) "audio/basic" ending-pos => int(1507722) line-count => int(553) starting-pos => int(1467530) starting-pos-body => int(1467637) transfer-encoding => string(6) "base64" Part 1.12 body-line-count => int(3282) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(22) "Multiple encapsulation" content-type => string(14) "message/rfc822" ending-pos => int(1819378) line-count => int(3285) starting-pos => int(1507750) starting-pos-body => int(1507824) transfer-encoding => string(4) "8bit" Part 1.12.1 body-line-count => int(3271) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(36) "16819560-2078917053-688350843:#11603" content-type => string(15) "multipart/mixed" ending-pos => int(1819378) line-count => int(3282) starting-pos => int(1507824) starting-pos-body => int(1508362) transfer-encoding => string(4) "8bit" Part 1.12.1.1 body-line-count => int(861) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "The Simpsons!!" content-type => string(22) "application/postscript" ending-pos => int(1560994) line-count => int(865) starting-pos => int(1508401) starting-pos-body => int(1508509) transfer-encoding => string(6) "base64" Part 1.12.1.2 body-line-count => int(299) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(28) "Alice's PDP-10 w/ TECO & DDT" content-name => string(13) "Alices_PDP-10" content-type => string(6) "binary" ending-pos => int(1579392) line-count => int(303) starting-pos => int(1561034) starting-pos-body => int(1561161) transfer-encoding => string(6) "base64" Part 1.12.1.3 body-line-count => int(2094) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(12) "Going deeper" content-type => string(14) "message/rfc822" ending-pos => int(1819337) line-count => int(2097) starting-pos => int(1579432) starting-pos-body => int(1579496) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1 body-line-count => int(2087) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(12) "foobarbazola" content-type => string(15) "multipart/mixed" ending-pos => int(1819337) line-count => int(2094) starting-pos => int(1579496) starting-pos-body => int(1579726) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.1 body-line-count => int(7) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(1580054) line-count => int(8) starting-pos => int(1579741) starting-pos-body => int(1579742) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.2 body-line-count => int(838) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(13) "seconddivider" content-type => string(18) "multipart/parallel" ending-pos => int(1739553) line-count => int(840) starting-pos => int(1580070) starting-pos-body => int(1580127) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.2.1 body-line-count => int(16) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(5) "Bunny" content-type => string(9) "image/gif" ending-pos => int(1583489) line-count => int(20) starting-pos => int(1580143) starting-pos-body => int(1580229) transfer-encoding => string(6) "base64" Part 1.12.1.3.1.2.2 body-line-count => int(807) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "TV Theme songs" content-type => string(11) "audio/basic" ending-pos => int(1739502) line-count => int(811) starting-pos => int(1583506) starting-pos-body => int(1583603) transfer-encoding => string(6) "base64" Part 1.12.1.3.1.3 body-line-count => int(195) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(22) "application/atomicmail" ending-pos => int(1744335) line-count => int(197) starting-pos => int(1739568) starting-pos-body => int(1739606) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.4 body-line-count => int(1031) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(27) "Yet another level deeper..." content-type => string(14) "message/rfc822" ending-pos => int(1819320) line-count => int(1034) starting-pos => int(1744351) starting-pos-body => int(1744430) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.4.1 body-line-count => int(1023) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(13) "I'm Twying..." content-type => string(11) "audio/x-sun" ending-pos => int(1819320) line-count => int(1031) starting-pos => int(1744430) starting-pos-body => int(1744660) transfer-encoding => string(6) "base64" Index: pear/PECL/mailparse/tests/testdata/multimedia-demo.txt.gz +++ pear/PECL/mailparse/tests/testdata/multimedia-demo.txt.gz ÈË= multimedia-demo.txt ÌýY«J&_¿ü°¾éª<ÇÏî·¬C#k³6Æ FÐÖÿý[ÄÉ©²2«««úâ;v¶íØ!kgpÀÙ4¯â£h¢ÿ¶ü\þêíýQ~w¯ò×õêòq|$üøÐ>é÷ þ½L>ì³ó!R¹UÐ%¿ùÝúsÔüÛ?÷ ÂÇ?ÀáÿÈm 84hËæÑVòã¿þí&ÿ;÷aDÞçÝã"ÁG<ò8)^eÛ5A÷~qÎ9-ÿÆI¸ã£H~¹&MþþCüUøà¯²KÊîg¬æ^_ggtÜyëÕ _}Íøÿ½ÞA|÷í#(>¸cÒ¶ÁwòË.þýÇ]¿ ¿jÚ¯ªFDU¨ôë<àͯQýúþs¸ÿ§îÜ]ßþþãdqÞ/üüxHÆ÷«ÛßÃÏÝ :Èq¿üò-ÿUgµç ÛøÜú`´Qó¨ºñ*ÊYá8çþh?àÿ௦ë~?ZM÷Û|¾Ýý#)£ jû¿¸ýõãc>÷s4ãGô*ª<þxÄÇûþjªoªùïG77Ù½>!i¢ü¦}¥Ý;hPùýÑÝ®LÞÿ¬8SÛóÔÇ¿þëp\ÏÛ5:m$ýí8=¢ûÝÏØ9îDÉ%½tNòøQQûkÓwßs>ÂñãïûþAùUUÐÅýÅ\-?N {üNÒ¯þøÇGüñù)FÿËÓ'¿ûäU}PñCP~¯H¿äßjà/ºÍýN@; EçãNþU@§ø«ð¯öÜÿóÓ@±"üËF´ßòï±ö±>;=ÒîÞUÒü&y½äWß¿¿qYý{ã¿Õøw$eØ·÷ÑüßìÖ?È¿HþüãOÿæTÃöOé«ùx$]úû¿ýËÿ½. Õ%höïtè_6<ÿ÷ïmX¢k.,(°ÃüuyٻůøWYùõl~Ú¿ó«±3ëÕ¯îåwÃøkÛò¯²È}üé?Hx<ÿ iù·þ²ø_þâð¿ì'`óz:c³2cózÆærm¼/ÿGYGéÖ`ÓYÿíoíþ þÿ¶~C3èîAùHò)Y lÿÓ÷Ëg7Éû?vðü I"^ø ÿWhñ33Ì ïfGüÈé?ýÚÁñÍ|ÈÿXüáwÿãFÿû¢ÿýF§ýçÿ÷~xç_É?Ø :Û×ìêGñhÓ IþÔDÁ{Ð~Ò H?`v 5?þóòçÌ,î'Aä2NbîÉÃWüøAí]ú1¾úx$^h¦jô1ünþ°ùüç>x As¸òÕ}I÷[G 8gú ¬ÃüÀ f þéÓä¿õåwóïÚWÌó¾ÿô.Ï_ï:6~ä¯×óc¦ ò;ÞÝ kó¯ßö>öçãG97P}7¿u÷¯{´ ¿Þ Ðï~ÚNл¿Ãx?j¡K`<A áýí}Y¿ÌmÁù¹?&ÀGþ(ü¡-8¦ùüåUÂ÷Ø"õsòäçþóÔνOßúÀýÿù¨~n¶ûcaÿynÿjú¾m÷×çîûw&$Çí x¢òúi1Oß=rûþù~,ÌÍ<ãPfõüøññ!í0ãÚþª³èãO3¾ÊþØ ø¼r(°|üíì?3ûê¹ ÈÚ>ü=ÇFѵ¿áßcSt¿þ±`>1vôÅ߯¿Tÿí/¨0[¢ÿï?rÜ?}|ÂCyþ;ÿ¹uDÓý÷?É?o=§803Î0NöN~~~õßwLßýdõ¬£ÊxÎÝfWÌgo{¸4ï_=lðýý<î<W äW<øÇ*û"¯>ÚßÍ'*Æç1ëåîÕýt=àï_~ùøNº¹ï\óø9Ã?ëõ<Ýs~ª¬}<hþØÆÜ£"#ýhyäMZ0J8òûÕç1ôúw?QÀßÁÏÐ?ÚûëýKÛ½ªê§¼ãO0ßÁø»^OöcÐþH¥pgÎ9Öp¢?× ÷VìþsñçoÍýëæ?Ïø- ¿~C¶ ÿ3íOÁüd0è×Ç9?Ð2ÏÇï>.sÀý>¸ÿ@©ü=(Cÿszøü3oü¹í/N©À)}í/á7ñç;øïþöºØýtqÆ%Ô¬øs÷P¡V_ÖeôQó÷uÿ©ý¥j`sÿK¨ðñî¸ð_Ëü~þ$¿ÁCëEû?ýá÷w ããï÷büWô/þSæ©ûñHÿô¿Çîß *?gF>õ_´ò6Üÿ9Úpqnø÷ÿ! q>þ=Äý-úø7CÐ#ñ âþCHôñHÄýG è㯡ûX4÷ú¿ÿêý_þoàÙo`TUþ~r¿içGÙ&Çý÷0Á[ÿÏH~'ªDRíqÿ}þgÜþaúþ§(ýü ¬>¨ÿùÇÕÿõÿXògÁý÷¿.æÿùïWÜ¿E~ÿ57ý§²ûÿqÂýIpÿë/NüV#ÿëÿù#pÿaAòÏÑû×ÉÿIòG àþ£ä¸ÿ(ùï`ÇþFýûû7dø-]_hNë?,þ1çU¼ÂÇóñËòþúõ¯ÖQ?þá_ût½ºüã<ÿ»çóõì9å¯ö¼÷ëÒ:rÿÏ?çü2¯»þÃlþ?Î09?NùUþño.©I\R%þqIMû°¢îg ü^¢¿ÇôÃ^Ík,På/6Lþïÿµã¢Øÿfÿç£U _§å "+kDÚï%å#ú¿º&hXQ~[Ȩ«ÀÀÝQü^?Ö«ç ¨¢úon «?-ýÅÚÑß>à·£¿Øø[KIµEEQ4Q_ÿÐËÿö·ÇôO?ë9ÿ¬ó^ÁùYÂùMøYøgPø·>~¼P´è_ìp@¢Ê»lõÇoãmb|c7/ÃmWÞÜý#pþôÞ$iÄ#µÓAM¼Ò{ ¶²7obäùM Åm¸Î:%ÜïкGLcvM,Ü'x!Ò$}jl©>Õ¾iC<¨qé+AÊ<yì$2§%Â3 ¦K±=½-æy *+ÕdIª/ø¸Çu$aÆ"j ky8éJÊJäÒð «´ÔÆcTÀp¼¡\ECnv©=Ô[©÷ b£ß*eà-ÞQ˱> /.ñ:ûô&!2ÌT¾ÉäwJR¾T]g!Âû>,Í)q*ØJëO 4 ñiCL~Û{óiã@ÈÛ¼ÓòÞ¸QjÈfò:9ÕKDuY³¦]åyÉùnNSVÂç×Ouáê>£<Sâr¡!DT6|Z"/q¯ö Mõ|H ¥C,Ç1Ë5Ê£SzRû.ÛMæKÊ;(DÊç1*GFGpÞúåG0¥gm|é5r(u¥'Å»Ê@íÐDSÛa)¢|lcØ^IKSMõ+ð>ÆPRs:ÄVóÔ,ôPkÔÉ´dG¥\¤ûnühAlºÈó(ò6bêÅ8Ñï2DâU0¦ôlÐ Ux1ç0+î)çnîæîI0JïÎB¼èOZÍ.1ïÝ[ʹÊö<±B·&FíÕl¸fHù]9Õ'Þ qÚjV鱦ôª½I#é â5¤G*¯gÑs5emáÛ¡IÓR=Þ°4õU.AÓ#È.{HK;&Yû3MHȸ"tÿ:¥p&ÄÙºS0RÕD^® t8àKS©ÝQ¼ùÉß1"VZfÆ F£|%IïP~Æ× ¢+Ä6êÌIïRÛ ¾W4÷E*(TH#L(r µÇÒýRg"©=çå µQ\z=-ʸqB z¯y"ÀBÅâr/éz;¦ö$ÅÞSXàîfe¥ÌS Y>kH¢ªfIZÊm÷Ðʶ 'ÉÖá!OE¥"'i s ̤F¨ª¼Bçz¨3#öISÚ[æ"áa/+%aw{'NçÈä5IîAäPI#¾yÐíÊØê°^~÷Û5qJ@Á¥éÈ> $´'ÚFTø²Ñô²½"Ñ6ï©£-U¸Teß!qÚDJègÒ°@ªBF#¯U¬r sN%Î2OÓ! PbµïîK.Ò'R{! CM]åxÑzÒ(<jÕAÞø}ªS%ö¼cSHLÀøw)tEÆ nUû¨Þ~dÔ²eÔB¢+$eÀÇ ß1¾Ë yùæ#ô®,*·S%ÕÊñlBÈvjGj oñä5¾£RTí PAÐ#ÝXDÒÐ'ú© Ï;9NEªõSÍ©}úT¡«Up"ª [HÒf"øò]L =^3Ó¤3 Ö©½WÎ0¬¥1£#}3Å8WL®¤¥ÏC L|©LйÕ"x;sY å`x ÷ oÄH¿JI)*pTn)äÎ ¤ðÏ2ð)AaKð §A¨ó6DTX:¦zÇC¯Å]êLÔJ D #¶¬õXÒP(`@Ä)ö~ óh`Uï 6ALÐ<_j Ì^1Âà $ø óܨÑ*Ù¥ePäÐê¢÷ ³ùcRå{È"9 h1G°kBàDàò4R=V¯þªÄI/Ã@«/ª^âS{¦´H7Âw@®¸¹~Ú1Ma9ÍfJj3À@E¶$ÐýFE^ æd~yeµ'LzÔNE¨x÷&É'57oÃ;îm¨{Ð SE CÜÔÃTM£åEPz' ۸ÃÉC¬±"òU9S*$×@=&|T} ìAø¤¦¥¢{Hµ3ø£+ÉV<»ó\X"´%P h4£Ãº(ÚCî$òñuDìx ºÇ r@(%t&yÝVÔ¨Ü7þh 2é1ÞRïËXDÔRC¡B:Ø ²&Àª+ÐGÛîè>O¥o*¥·5gîÊ¥XïÄ» vô;õÀôAK\ ÐÊT-iXOçHæ K>õÀ#Ö;-!{Ê裪g,Òý&ö ¡·)sxÛ,ÌeåLBjcÊðQ»c*²H¬¦Py< 8Õ@ B2:H£¶('(É^ç{H:úØ%Ó ²xùµET Fè¥Ï£2mY±øNÈÛxÖ¥È[ `L{9h Øcu¶âéZ@zñÝf]kÈ ÈBoÂÆª¢(SAÁ) µ2PL¾®ò̸¨!@üZ²v;AÔÔ m ·Çr¨JÎRÙAT°!k6CH@,íù $rf<ßäéÍ ¾ðþ$mÇÐJa¡(|?µ*ªÛ<òR-à5cX`0`"HC÷É+N72ewZ mx(ª?eÈz-A,acóÌ¥%SÌ$$ÌLêR «mCúÃ;´>ùò*\K3Æë¹¢¦Fe¬ÌðÃã½DQ8+¹_n£ª7¬¡AÂõ ¾¿qâtÄ*kÔJX¦þÔ`¹)#²F?©!ÞW!ä° *(hÀº¯'i @õÄôÌf Àíùx«´±îÊÐ2®ÌÀÇ8äAA?W±9IUÿ6ÉÀÚ%e3ϨÛY"$êïï,ÀW!ìIË{¦ÂR²ü_A}RÐ*V^þú!s y@ÕÂq6\îÆO×¹W+ÁDç\È ±¦Ã< ß¼ ÚCâb5B×nK$°]R÷íoc_Ý>la¶p,äàEª&.ãÌ÷q=ù²0ïI@®âß5à¾4fæÆs÷E ùõUj ÇÀ{ l>+cuCµ ¬õ9¤d¡þ+¯{ ÑIEÆ'Àì$$=jµR© h$.¶Ê0¹VP!¡nÈ)òA¡µ&í7wz G$Ä«¨d (É0)© ÐFNA"
Index: pear/PECL/mailparse/mailparse.c diff -u pear/PECL/mailparse/mailparse.c:1.34 pear/PECL/mailparse/mailparse.c:1.35 --- pear/PECL/mailparse/mailparse.c:1.34 Tue Nov 19 07:36:13 2002 +++ pear/PECL/mailparse/mailparse.c Tue Nov 19 13:40:07 2002 @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: mailparse.c,v 1.34 2002/11/19 12:36:13 wez Exp $ */ +/* $Id: mailparse.c,v 1.35 2002/11/19 18:40:07 wez Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -651,7 +651,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "mailparse support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.34 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.35 $"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -1364,10 +1364,7 @@ zend_hash_get_current_key_ex(Z_ARRVAL_P(attr->attributes), &key, &key_len, NULL, 0, &pos); - newkey = emalloc(key_len + pref_len + 1); - strcpy(newkey, attrprefix); - strcat(newkey, key); - + spprintf(&newkey, 0, "%s%s", attrprefix, key); add_assoc_string(return_value, newkey, Z_STRVAL_PP(val), 1); efree(newkey); @@ -1388,10 +1385,19 @@ static void add_header_reference_to_zval(char *headerkey, zval *return_value, zval *headers TSRMLS_DC) { zval **headerval; + zval *newhdr; if (SUCCESS == zend_hash_find(Z_ARRVAL_P(headers), headerkey, strlen(headerkey)+1, (void**)&headerval)) { +#if 1 + MAKE_STD_ZVAL(newhdr); + *newhdr = **headerval; + INIT_PZVAL(newhdr); + zval_copy_ctor(newhdr); + zend_hash_update(Z_ARRVAL_P(return_value), headerkey, strlen(headerkey)+1, (void**)&newhdr, sizeof(zval *), NULL); +#else ZVAL_ADDREF(*headerval); zend_hash_update(Z_ARRVAL_P(return_value), headerkey, strlen(headerkey)+1, (void**)headerval, sizeof(zval *), NULL); +#endif } } @@ -1423,7 +1429,7 @@ if (part->charset) add_assoc_string(return_value, "charset", part->charset, 1); else - add_assoc_string(return_value, "charset", "us-ascii", 1); + add_assoc_string(return_value, "charset", MAILPARSEG(def_charset), 1); if (part->content_transfer_encoding) add_assoc_string(return_value, "transfer-encoding", part->content_transfer_encoding, 1); @@ -1432,6 +1438,8 @@ if (part->content_type) add_attr_header_to_zval("content-type", "content-", return_value, part->content_type TSRMLS_CC); + else + add_assoc_string(return_value, "content-type", "text/plain; (error)", 1); if (part->content_disposition) add_attr_header_to_zval("content-disposition", "disposition-", return_value, part->content_disposition TSRMLS_CC); Index: pear/PECL/mailparse/php_mailparse_mime.c diff -u pear/PECL/mailparse/php_mailparse_mime.c:1.9 pear/PECL/mailparse/php_mailparse_mime.c:1.10 --- pear/PECL/mailparse/php_mailparse_mime.c:1.9 Tue Nov 19 07:36:14 2002 +++ pear/PECL/mailparse/php_mailparse_mime.c Tue Nov 19 13:40:07 2002 @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_mailparse_mime.c,v 1.9 2002/11/19 12:36:14 wez Exp $ */ +/* $Id: php_mailparse_mime.c,v 1.10 2002/11/19 18:40:07 wez Exp $ */ #include "php.h" #include "php_mailparse.h" @@ -24,7 +24,7 @@ #define MAXLEVELS 20 #define MAXPARTS 300 -#define IS_MIME_1(part) ((part)->mime_version && strcmp("1.0", (part)->mime_version) == 0) +#define IS_MIME_1(part) (((part)->mime_version && strcmp("1.0", (part)->mime_version) == 0) || ((part)->parent)) #define CONTENT_TYPE_IS(part, contenttypevalue) ((part)->content_type && strcasecmp((part)->content_type->value, contenttypevalue) == 0) #define CONTENT_TYPE_ISL(part, contenttypevalue, len) ((part)->content_type && strncasecmp((part)->content_type->value, contenttypevalue, len) == 0) @@ -175,11 +175,14 @@ STR_FREE(part->mime_version); STR_FREE(part->content_transfer_encoding); STR_FREE(part->charset); + STR_FREE(part->boundary); STR_FREE(part->content_base); STR_FREE(part->content_location); - if (part->content_type) + if (part->content_type) { php_mimeheader_free(part->content_type); + part->content_type = NULL; + } if (part->content_disposition) php_mimeheader_free(part->content_disposition); @@ -286,13 +289,19 @@ if (strcmp(header_key, "content-transfer-encoding") == 0) STR_SET_REPLACE(part->content_transfer_encoding, header_val_stripped); if (strcmp(header_key, "content-type") == 0) { - char *charset; + char *charset, *boundary; - if (part->content_type) + if (part->content_type) { php_mimeheader_free(part->content_type); + part->content_type = NULL; + } part->content_type = php_mimeheader_alloc_from_tok(toks); - part->boundary = php_mimepart_attribute_get(part->content_type, "boundary"); + + boundary = php_mimepart_attribute_get(part->content_type, "boundary"); + if (boundary) { + part->boundary = estrdup(boundary); + } charset = php_mimepart_attribute_get(part->content_type, "charset"); if (charset) { @@ -360,30 +369,27 @@ } } -static int php_mimepart_process_line(php_mimepart *part TSRMLS_DC) +static int php_mimepart_process_line(php_mimepart *workpart TSRMLS_DC) { - php_mimepart *workpart; size_t origcount, linelen; char *c; /* sanity check */ - if (zend_hash_num_elements(&part->children) > MAXPARTS) { + if (zend_hash_num_elements(&workpart->children) > MAXPARTS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "MIME message too complex"); return FAILURE; } - c = part->parsedata.workbuf.c; - smart_str_0(&part->parsedata.workbuf); + c = workpart->parsedata.workbuf.c; + smart_str_0(&workpart->parsedata.workbuf); /* strip trailing \r\n -- we always have a trailing \n */ - origcount = part->parsedata.workbuf.len; + origcount = workpart->parsedata.workbuf.len; linelen = origcount - 1; if (linelen && c[linelen-1] == '\r') --linelen; /* Discover which part we were last working on */ - workpart = part; - while (workpart->parsedata.lastpart) { int bound_len; php_mimepart *lastpart = workpart->parsedata.lastpart; @@ -462,11 +468,18 @@ if (!IS_MIME_1(workpart)) { /* if we don't understand the MIME version, discard the content-type and * boundary */ - if (part->content_type) - php_mimeheader_free(part->content_type); - if (part->content_disposition) - php_mimeheader_free(part->content_disposition); - workpart->boundary = NULL; + if (workpart->content_disposition) { + php_mimeheader_free(workpart->content_disposition); + workpart->content_disposition = NULL; + } + if (workpart->boundary) { + efree(workpart->boundary); + workpart->boundary = NULL; + } + if (workpart->content_type) { + php_mimeheader_free(workpart->content_type); + workpart->content_type = NULL; + } workpart->content_type = php_mimeheader_alloc("text/plain"); } /* if there is no content type, default to text/plain, but use multipart/digest when in Index: pear/PECL/mailparse/tests/parse_test_messages.phpt +++ pear/PECL/mailparse/tests/parse_test_messages.phpt --TEST-- Parse messages in testdata dir --SKIPIF-- <?php /* vim600: sw=4 ts=4 fdm=marker syn=php */ if (!extension_loaded("mailparse")) print "skip"; ?> --FILE-- <?php error_reporting(~E_NOTICE); $define_expect = isset($argv[1]) && $argv[1] == "define_expect"; $testdir = dirname(__FILE__) . "/testdata"; $dir = opendir($testdir) or die("unable to open test dir!"); $messages = array(); while (($f = readdir($dir)) !== false) { if ($f == "CVS" || $f == "." || $f == "..") continue; list($name, $suffix) = explode(".", $f, 2); switch($suffix) { case "txt": case "txt.gz": $messages[$name]["testfile"] = $f; break; case "exp": $messages[$name]["expectfile"] = $f; break; } } if (false) { $messages = array("multimedia-demo" => array("testfile" => "multimedia-demo.txt.gz", "expectfile" => "multimedia-demo.exp")); } if (function_exists("version_compare") && version_compare(phpversion(), "4.3", "ge")) { $wrapper = "compress.zlib://"; } else { /* this section is here because it is useful to compare to the * original implementaion of mailparse for PHP 4.2 */ $wrapper = "zlib:"; function file_get_contents($filename) { $fp = fopen($filename, "rb"); $data = fread($fp, filesize($filename)); fclose($fp); return $data; } } function diff_strings($left, $right) { if (is_executable("/usr/bin/diff")) { $lf = tempnam("/tmp", "mpt"); $rf = tempnam("/tmp", "mpt"); $ok = false; $fp = fopen($lf, "wb"); if ($fp) { fwrite($fp, $left); fclose($fp); $fp = fopen($rf, "wb"); if ($fp) { fwrite($fp, $right); fclose($fp); $ok = true; } } if ($ok) { passthru("/usr/bin/diff -u $lf $rf"); } unlink($lf); unlink($rf); if ($ok) return; } $left = explode("\n", $left); $right = explode("\n", $right); $n = max(count($left), count($right)); $difflines = array(); $runstart = null; $runend = null; for ($i = 0; $i < $n; $i++) { if ($left[$i] != $right[$i]) { if ($runstart === null) { $runstart = $i; $runend = $i; } else { /* part of the run */ $runend = $i; } } else { if ($runstart !== null) { $difflines[] = array($runstart, $runend); $runstart = null; $runend = null; } } } if ($runstart !== null) $difflines[] = array($runstart, $runend); $lastprint = null; foreach ($difflines as $run) { list($start, $end) = $run; $startline = $start - 3; if ($startline < 0) $startline = 0; $endline = $end; if ($lastprint === null) { echo "@@ Line: " . ($startline+1) . "\n"; } else if ($startline <= $lastprint) { $startline = $lastprint+1; } if ($startline > $endline) continue; /* starting context */ for ($i = $startline; $i < $start; $i++) { echo " " . $left[$i] . "\n"; $lastprint = $i; } /* diff run */ for ($i = $start; $i <= $end; $i++) { echo "-" . $left[$i] . "\n"; } for ($i = $start; $i <= $end; $i++) { echo "+" . $right[$i] . "\n"; } $lastprint = $i; } } $skip_keys = array("headers", "ending-pos-body"); foreach ($messages as $name => $msgdata) { $testname = $testdir . "/" . $msgdata["testfile"]; $expectname = $testdir . "/" . $msgdata["expectfile"]; $use_wrapper = substr($testname, -3) == ".gz" ? $wrapper : ""; $fp = fopen("$use_wrapper$testname", "rb") or die("failed to open the file!"); $mime = mailparse_msg_create(); while (!feof($fp)) { $data = fread($fp, 1024); if ($data !== false) mailparse_msg_parse($mime, $data); } fclose($fp); $struct = mailparse_msg_get_structure($mime); ob_start(); echo "Message: $name\n"; foreach($struct as $partname) { $depth = count(explode(".", $partname)) - 1; $indent = str_repeat(" ", $depth * 2); $subpart = mailparse_msg_get_part($mime, $partname); if (!$subpart) { var_dump($struct); break; } $data = mailparse_msg_get_part_data($subpart); echo "\n{$indent}Part $partname\n"; ksort($data); foreach ($data as $key => $value) { if (in_array($key, $skip_keys)) continue; echo "$indent$key => "; var_dump($value); } } $output = ob_get_contents(); if ($define_expect) { $fp = fopen($expectname, "wb"); fwrite($fp, $output); fclose($fp); } else { $expect = file_get_contents($expectname); if ($output != $expect) { ob_end_flush(); diff_strings($expect, $output); die("FAIL!"); } } ob_end_clean(); } echo "All messages parsed OK!"; ?> --EXPECT-- All messages parsed OK! Index: pear/PECL/mailparse/tests/testdata/mime.exp +++ pear/PECL/mailparse/tests/testdata/mime.exp Message: mime Part 1 body-line-count => int(27) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(41) "----=_NextPart_000_0007_01C2566B.DA7C64F0" content-type => string(15) "multipart/mixed" ending-pos => int(1488) line-count => int(47) starting-pos => int(0) starting-pos-body => int(856) transfer-encoding => string(4) "8bit" Part 1.1 body-line-count => int(1) charset => string(8) "us-ascii" content-base => string(1) "/" content-charset => string(8) "us-ascii" content-type => string(10) "text/plain" ending-pos => int(1081) line-count => int(5) starting-pos => int(949) starting-pos-body => int(1032) transfer-encoding => string(4) "7bit" Part 1.2 body-line-count => int(7) charset => string(8) "us-ascii" content-base => string(1) "/" content-disposition => string(10) "attachment" content-name => string(6) "README" content-type => string(24) "application/octet-stream" disposition-filename => string(6) "README" ending-pos => int(1435) line-count => int(13) starting-pos => int(1128) starting-pos-body => int(1286) transfer-encoding => string(16) "quoted-printable" Index: pear/PECL/mailparse/tests/testdata/mime.txt +++ pear/PECL/mailparse/tests/testdata/mime.txt Return-Path: <wez@thebrainroom.com> Received: from TITAN (titan.brainnet.i [192.168.2.7]) by zaneeb.brainnet.i (8.10.2/8.10.2/SuSE Linux 8.10.0-0.3) with ESMTP id g87BfJ721279 for <wez@thebrainroom.com>; Sat, 7 Sep 2002 12:41:19 +0100 X-Authentication-Warning: zaneeb.brainnet.i: Host titan.brainnet.i [192.168.2.7] claimed to be TITAN From: "Wez Furlong" <wez@thebrainroom.com> To: <wez@thebrainroom.com> Subject: mime attach Date: Sat, 7 Sep 2002 12:41:14 +0100 Message-ID: <000601c25663$78b7fcf0$0702a8c0@TITAN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0007_01C2566B.DA7C64F0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-TBR-DestBox: user.wez (auth as wez) (wez:) This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C2566B.DA7C64F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit this is a message with regular mime attachment. ------=_NextPart_000_0007_01C2566B.DA7C64F0 Content-Type: application/octet-stream; name="README" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="README" FooBar - blah blah blah foo bar bar baaaa=0A= =0A= Requirements: =0A= o php with mailparse=0A= o virus scanner (optional)=0A= =0A= =0A= ------=_NextPart_000_0007_01C2566B.DA7C64F0-- Index: pear/PECL/mailparse/tests/testdata/multimedia-demo.exp +++ pear/PECL/mailparse/tests/testdata/multimedia-demo.exp Message: multimedia-demo Part 1 body-line-count => int(25863) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(11) "owatagusiam" content-type => string(15) "multipart/mixed" ending-pos => int(1819395) line-count => int(25876) starting-pos => int(0) starting-pos-body => int(390) transfer-encoding => string(4) "8bit" Part 1.1 body-line-count => int(3) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(11) "Explanation" content-type => string(10) "text/plain" ending-pos => int(650) line-count => int(6) starting-pos => int(404) starting-pos-body => int(463) transfer-encoding => string(4) "8bit" Part 1.2 body-line-count => int(106) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Rich Text demo" content-type => string(14) "message/rfc822" ending-pos => int(5532) line-count => int(109) starting-pos => int(665) starting-pos-body => int(731) transfer-encoding => string(4) "8bit" Part 1.2.1 body-line-count => int(83) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(55) "Interpart_Boundary_AdJn:mu0M2YtJKaFh9AdJn:mu0M2YtJKaFk=" content-type => string(21) "multipart/alternative" ending-pos => int(5532) line-count => int(106) starting-pos => int(731) starting-pos-body => int(1913) transfer-encoding => string(4) "8bit" Part 1.2.1.1 body-line-count => int(16) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(3249) line-count => int(17) starting-pos => int(2497) starting-pos-body => int(2498) transfer-encoding => string(4) "8bit" Part 1.2.1.2 body-line-count => int(19) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(57) "Alternative_Boundary_8dJn:mu0M2Yt5KaFZ8AdJn:mu0M2Yt1KaFdA" content-type => string(15) "multipart/mixed" ending-pos => int(4482) line-count => int(22) starting-pos => int(3308) starting-pos-body => int(3411) transfer-encoding => string(4) "8bit" Part 1.2.1.2.1 body-line-count => int(13) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(13) "text/richtext" ending-pos => int(4418) line-count => int(16) starting-pos => int(3471) starting-pos-body => int(3544) transfer-encoding => string(16) "quoted-printable" Part 1.2.1.3 body-line-count => int(27) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(24) "application/andrew-inset" ending-pos => int(5470) line-count => int(29) starting-pos => int(4540) starting-pos-body => int(4580) transfer-encoding => string(4) "8bit" Part 1.3 body-line-count => int(7605) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(15) "Voice Mail demo" content-type => string(14) "message/rfc822" ending-pos => int(560279) line-count => int(7608) starting-pos => int(5546) starting-pos-body => int(5613) transfer-encoding => string(4) "8bit" Part 1.3.1 body-line-count => int(7586) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(7) "Hi Mark" content-type => string(11) "audio/basic" ending-pos => int(560279) line-count => int(7605) starting-pos => int(5613) starting-pos-body => int(6556) transfer-encoding => string(6) "base64" Part 1.4 body-line-count => int(465) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(11) "Flint phone" content-type => string(11) "audio/basic" ending-pos => int(596156) line-count => int(469) starting-pos => int(560293) starting-pos-body => int(560387) transfer-encoding => string(6) "base64" Part 1.5 body-line-count => int(23) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(11) "MTR's photo" content-type => string(9) "image/pbm" ending-pos => int(598054) line-count => int(27) starting-pos => int(596171) starting-pos-body => int(596263) transfer-encoding => string(6) "base64" Part 1.6 body-line-count => int(4565) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(15) "Star Trek Party" content-type => string(14) "message/rfc822" ending-pos => int(776452) line-count => int(4568) starting-pos => int(598069) starting-pos-body => int(598136) transfer-encoding => string(4) "8bit" Part 1.6.1 body-line-count => int(4532) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(14) "Outermost_Trek" content-type => string(15) "multipart/mixed" ending-pos => int(776452) line-count => int(4565) starting-pos => int(598136) starting-pos-body => int(599956) transfer-encoding => string(4) "8bit" Part 1.6.1.1 body-line-count => int(451) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(28) "Where_No_One_Has_Gone_Before" content-type => string(15) "multipart/mixed" ending-pos => int(631998) line-count => int(453) starting-pos => int(599973) starting-pos-body => int(600042) transfer-encoding => string(4) "8bit" Part 1.6.1.1.1 body-line-count => int(16) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(600789) line-count => int(17) starting-pos => int(600073) starting-pos-body => int(600074) transfer-encoding => string(4) "8bit" Part 1.6.1.1.2 body-line-count => int(426) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "He's dead, Jim" content-type => string(11) "audio/x-sun" ending-pos => int(631964) line-count => int(430) starting-pos => int(600821) starting-pos-body => int(600918) transfer-encoding => string(6) "base64" Part 1.6.1.2 body-line-count => int(3418) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(28) "Where_No_Man_Has_Gone_Before" content-type => string(15) "multipart/mixed" ending-pos => int(729141) line-count => int(3420) starting-pos => int(632015) starting-pos-body => int(632084) transfer-encoding => string(4) "8bit" Part 1.6.1.2.1 body-line-count => int(352) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(16) "Kirk/Spock/McCoy" content-type => string(9) "image/gif" ending-pos => int(657860) line-count => int(356) starting-pos => int(632115) starting-pos-body => int(632212) transfer-encoding => string(6) "base64" Part 1.6.1.2.2 body-line-count => int(253) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(25) "Star Trek Next Generation" content-type => string(9) "image/gif" ending-pos => int(676411) line-count => int(257) starting-pos => int(657892) starting-pos-body => int(657998) transfer-encoding => string(6) "base64" Part 1.6.1.2.3 body-line-count => int(2436) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(17) "application/x-be2" content-version => string(2) "12" ending-pos => int(720176) line-count => int(2438) starting-pos => int(676443) starting-pos-body => int(676487) transfer-encoding => string(4) "8bit" Part 1.6.1.2.4 body-line-count => int(357) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(22) "application/atomicmail" content-version => string(4) "1.12" ending-pos => int(729107) line-count => int(359) starting-pos => int(720208) starting-pos-body => int(720261) transfer-encoding => string(4) "8bit" Part 1.6.1.3 body-line-count => int(647) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Distress calls" content-type => string(11) "audio/x-sun" ending-pos => int(776430) line-count => int(651) starting-pos => int(729158) starting-pos-body => int(729255) transfer-encoding => string(6) "base64" Part 1.7 body-line-count => int(483) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Digitizer test" content-type => string(14) "message/rfc822" ending-pos => int(862163) line-count => int(486) starting-pos => int(776466) starting-pos-body => int(776532) transfer-encoding => string(4) "8bit" Part 1.7.1 body-line-count => int(457) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(24) "mail.sleepy.sau.144.8891" content-type => string(15) "multipart/mixed" ending-pos => int(862163) line-count => int(483) starting-pos => int(776532) starting-pos-body => int(777838) transfer-encoding => string(4) "8bit" Part 1.7.1.1 body-line-count => int(0) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(777887) line-count => int(1) starting-pos => int(777865) starting-pos-body => int(777866) transfer-encoding => string(4) "8bit" Part 1.7.1.2 body-line-count => int(433) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(12) "Bellcore mug" content-type => string(9) "image/pgm" ending-pos => int(861843) line-count => int(439) starting-pos => int(777915) starting-pos-body => int(778102) transfer-encoding => string(6) "base64" Part 1.7.1.3 body-line-count => int(8) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(862131) line-count => int(9) starting-pos => int(861871) starting-pos-body => int(861872) transfer-encoding => string(4) "8bit" Part 1.8 body-line-count => int(431) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(12) "More Imagery" content-type => string(14) "message/rfc822" ending-pos => int(936281) line-count => int(434) starting-pos => int(862177) starting-pos-body => int(862241) transfer-encoding => string(4) "8bit" Part 1.8.1 body-line-count => int(406) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(23) "mail.sleepy.sau.158.532" content-type => string(15) "multipart/mixed" ending-pos => int(936281) line-count => int(431) starting-pos => int(862241) starting-pos-body => int(863504) transfer-encoding => string(4) "8bit" Part 1.8.1.1 body-line-count => int(26) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(864751) line-count => int(27) starting-pos => int(863530) starting-pos-body => int(863531) transfer-encoding => string(4) "8bit" Part 1.8.1.2 body-line-count => int(369) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(23) "Mail architecture slide" content-type => string(9) "image/pbm" ending-pos => int(936251) line-count => int(374) starting-pos => int(864778) starting-pos-body => int(864934) transfer-encoding => string(6) "base64" Part 1.9 body-line-count => int(6438) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(15) "PostScript demo" content-type => string(14) "message/rfc822" ending-pos => int(1327933) line-count => int(6441) starting-pos => int(936295) starting-pos-body => int(936362) transfer-encoding => string(4) "8bit" Part 1.9.1 body-line-count => int(6421) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "Captain Picard" content-type => string(22) "application/postscript" ending-pos => int(1327933) line-count => int(6438) starting-pos => int(936362) starting-pos-body => int(937199) transfer-encoding => string(4) "8bit" Part 1.10 body-line-count => int(1015) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(21) "Quoted-Printable test" content-type => string(9) "image/gif" ending-pos => int(1405346) line-count => int(1019) starting-pos => int(1327947) starting-pos-body => int(1328059) transfer-encoding => string(16) "quoted-printable" Part 1.11 body-line-count => int(1382) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(19) "q-p vs. base64 test" content-type => string(14) "message/rfc822" ending-pos => int(1507736) line-count => int(1385) starting-pos => int(1405361) starting-pos-body => int(1405432) transfer-encoding => string(4) "8bit" Part 1.11.1 body-line-count => int(1368) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(8) "hal_9000" content-type => string(15) "multipart/mixed" ending-pos => int(1507736) line-count => int(1382) starting-pos => int(1405432) starting-pos-body => int(1406106) transfer-encoding => string(4) "8bit" Part 1.11.1.1 body-line-count => int(807) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(21) "I'm sorry, Dave (q-p)" content-type => string(11) "audio/basic" ending-pos => int(1467518) line-count => int(811) starting-pos => int(1406117) starting-pos-body => int(1406231) transfer-encoding => string(16) "quoted-printable" Part 1.11.1.2 body-line-count => int(549) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(24) "I'm sorry, Dave (BASE64)" content-type => string(11) "audio/basic" ending-pos => int(1507722) line-count => int(553) starting-pos => int(1467530) starting-pos-body => int(1467637) transfer-encoding => string(6) "base64" Part 1.12 body-line-count => int(3282) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(22) "Multiple encapsulation" content-type => string(14) "message/rfc822" ending-pos => int(1819378) line-count => int(3285) starting-pos => int(1507750) starting-pos-body => int(1507824) transfer-encoding => string(4) "8bit" Part 1.12.1 body-line-count => int(3271) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(36) "16819560-2078917053-688350843:#11603" content-type => string(15) "multipart/mixed" ending-pos => int(1819378) line-count => int(3282) starting-pos => int(1507824) starting-pos-body => int(1508362) transfer-encoding => string(4) "8bit" Part 1.12.1.1 body-line-count => int(861) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "The Simpsons!!" content-type => string(22) "application/postscript" ending-pos => int(1560994) line-count => int(865) starting-pos => int(1508401) starting-pos-body => int(1508509) transfer-encoding => string(6) "base64" Part 1.12.1.2 body-line-count => int(299) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(28) "Alice's PDP-10 w/ TECO & DDT" content-name => string(13) "Alices_PDP-10" content-type => string(6) "binary" ending-pos => int(1579392) line-count => int(303) starting-pos => int(1561034) starting-pos-body => int(1561161) transfer-encoding => string(6) "base64" Part 1.12.1.3 body-line-count => int(2094) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(12) "Going deeper" content-type => string(14) "message/rfc822" ending-pos => int(1819337) line-count => int(2097) starting-pos => int(1579432) starting-pos-body => int(1579496) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1 body-line-count => int(2087) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(12) "foobarbazola" content-type => string(15) "multipart/mixed" ending-pos => int(1819337) line-count => int(2094) starting-pos => int(1579496) starting-pos-body => int(1579726) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.1 body-line-count => int(7) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(10) "text/plain" ending-pos => int(1580054) line-count => int(8) starting-pos => int(1579741) starting-pos-body => int(1579742) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.2 body-line-count => int(838) charset => string(8) "us-ascii" content-base => string(1) "/" content-boundary => string(13) "seconddivider" content-type => string(18) "multipart/parallel" ending-pos => int(1739553) line-count => int(840) starting-pos => int(1580070) starting-pos-body => int(1580127) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.2.1 body-line-count => int(16) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(5) "Bunny" content-type => string(9) "image/gif" ending-pos => int(1583489) line-count => int(20) starting-pos => int(1580143) starting-pos-body => int(1580229) transfer-encoding => string(6) "base64" Part 1.12.1.3.1.2.2 body-line-count => int(807) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(14) "TV Theme songs" content-type => string(11) "audio/basic" ending-pos => int(1739502) line-count => int(811) starting-pos => int(1583506) starting-pos-body => int(1583603) transfer-encoding => string(6) "base64" Part 1.12.1.3.1.3 body-line-count => int(195) charset => string(8) "us-ascii" content-base => string(1) "/" content-type => string(22) "application/atomicmail" ending-pos => int(1744335) line-count => int(197) starting-pos => int(1739568) starting-pos-body => int(1739606) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.4 body-line-count => int(1031) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(27) "Yet another level deeper..." content-type => string(14) "message/rfc822" ending-pos => int(1819320) line-count => int(1034) starting-pos => int(1744351) starting-pos-body => int(1744430) transfer-encoding => string(4) "8bit" Part 1.12.1.3.1.4.1 body-line-count => int(1023) charset => string(8) "us-ascii" content-base => string(1) "/" content-description => string(13) "I'm Twying..." content-type => string(11) "audio/x-sun" ending-pos => int(1819320) line-count => int(1031) starting-pos => int(1744430) starting-pos-body => int(1744660) transfer-encoding => string(6) "base64" Index: pear/PECL/mailparse/tests/testdata/multimedia-demo.txt.gz +++ pear/PECL/mailparse/tests/testdata/multimedia-demo.txt.gz ÈË= multimedia-demo.txt ÌýY«J&_¿ü°¾éª<ÇÏî·¬C#k³6Æ FÐÖÿý[ÄÉ©²2«««úâ;v¶íØ!kgpÀÙ4¯â£h¢ÿ¶ü\þêíýQ~w¯ò×õêòq|$üøÐ>é÷ þ½L>ì³ó!R¹UÐ%¿ùÝúsÔüÛ?÷ ÂÇ?ÀáÿÈm 84hËæÑVòã¿þí&ÿ;÷aDÞçÝã"ÁG<ò8)^eÛ5A÷~qÎ9-ÿÆI¸ã£H~¹&MþþCüUøà¯²KÊîg¬æ^_ggtÜyëÕ _}Íøÿ½ÞA|÷í#(>¸cÒ¶ÁwòË.þýÇ]¿ ¿jÚ¯ªFDU¨ôë<àͯQýúþs¸ÿ§îÜ]ßþþãdqÞ/üüxHÆ÷«ÛßÃÏÝ :Èq¿üò-ÿUgµç ÛøÜú`´Qó¨ºñ*ÊYá8çþh?àÿ௦ë~?ZM÷Û|¾Ýý#)£ jû¿¸ýõãc>÷s4ãGô*ª<þxÄÇûþjªoªùïG77Ù½>!i¢ü¦}¥Ý;hPùýÑÝ®LÞÿ¬8SÛóÔÇ¿þëp\ÏÛ5:m$ýí8=¢ûÝÏØ9îDÉ%½tNòøQQûkÓwßs>ÂñãïûþAùUUÐÅýÅ\-?N {üNÒ¯þøÇGüñù)FÿËÓ'¿ûäU}PñCP~¯H¿äßjà/ºÍýN@; EçãNþU@§ø«ð¯öÜÿóÓ@±"üËF´ßòï±ö±>;=ÒîÞUÒü&y½äWß¿¿qYý{ã¿Õøw$eØ·÷ÑüßìÖ?È¿HþüãOÿæTÃöOé«ùx$]úû¿ýËÿ½. Õ%höïtè_6<ÿ÷ïmX¢k.,(°ÃüuyٻůøWYùõl~Ú¿ó«±3ëÕ¯îåwÃøkÛò¯²È}üé?Hx<ÿ iù·þ²ø_þâð¿ì'`óz:c³2cózÆærm¼/ÿGYGéÖ`ÓYÿíoíþ þÿ¶~C3èîAùHò)Y lÿÓ÷Ëg7Éû?vðü I"^ø ÿWhñ33Ì ïfGüÈé?ýÚÁñÍ|ÈÿXüáwÿãFÿû¢ÿýF§ýçÿ÷~xç_É?Ø :Û×ìêGñhÓ IþÔDÁ{Ð~Ò H?`v 5?þóòçÌ,î'Aä2NbîÉÃWüøAí]ú1¾úx$^h¦jô1ünþ°ùüç>x As¸òÕ}I÷[G 8gú ¬ÃüÀ f þéÓä¿õåwóïÚWÌó¾ÿô.Ï_ï:6~ä¯×óc¦ ò;ÞÝ kó¯ßö>öçãG97P}7¿u÷¯{´ ¿Þ Ðï~ÚNл¿Ãx?j¡K`<A áýí}Y¿ÌmÁù¹?&ÀGþ(ü¡-8¦ùüåUÂ÷Ø"õsòäçþóÔνOßúÀýÿù¨~n¶ûcaÿynÿjú¾m÷×çîûw&$Çí x¢òúi1Oß=rûþù~,ÌÍ<ãPfõüøññ!í0ãÚþª³èãO3¾ÊþØ ø¼r(°|üíì?3ûê¹ ÈÚ>ü=ÇFѵ¿áßcSt¿þ±`>1vôÅ߯¿Tÿí/¨0[¢ÿï?rÜ?}|ÂCyþ;ÿ¹uDÓý÷?É?o=§803Î0NöN~~~õßwLßýdõ¬£ÊxÎÝfWÌgo{¸4ï_=lðýý<î<W äW<øÇ*û"¯>ÚßÍ'*Æç1ëåîÕýt=àï_~ùøNº¹ï\óø9Ã?ëõ<Ýs~ª¬}<hþØÆÜ£"#ýhyäMZ0J8òûÕç1ôúw?QÀßÁÏÐ?ÚûëýKÛ½ªê§¼ãO0ßÁø»^OöcÐþH¥pgÎ9Öp¢?× ÷VìþsñçoÍýëæ?Ïø- ¿~C¶ ÿ3íOÁüd0è×Ç9?Ð2ÏÇï>.sÀý>¸ÿ@©ü=(Cÿszøü3oü¹í/N©À)}í/á7ñç;øïþöºØýtqÆ%Ô¬øs÷P¡V_ÖeôQó÷uÿ©ý¥j`sÿK¨ðñî¸ð_Ëü~þ$¿ÁCëEû?ýá÷w ããï÷büWô/þSæ©ûñHÿô¿Çîß *?gF>õ_´ò6Üÿ9Úpqnø÷ÿ! q>þ=Äý-úø7CÐ#ñ âþCHôñHÄýG è㯡ûX4÷ú¿ÿêý_þoàÙo`TUþ~r¿içGÙ&Çý÷0Á[ÿÏH~'ªDRíqÿ}þgÜþaúþ§(ýü ¬>¨ÿùÇÕÿõÿXògÁý÷¿.æÿùïWÜ¿E~ÿ57ý§²ûÿqÂýIpÿë/NüV#ÿëÿù#pÿaAòÏÑû×ÉÿIòG àþ£ä¸ÿ(ùï`ÇþFýûû7dø-]_hNë?,þ1çU¼ÂÇóñËòþúõ¯ÖQ?þá_ût½ºüã<ÿ»çóõì9å¯ö¼÷ëÒ:rÿÏ?çü2¯»þÃlþ?Î09?NùUþño.©I\R%þqIMû°¢îg ü^¢¿ÇôÃ^Ík,På/6Lþïÿµã¢Øÿfÿç£U _§å "+kDÚï%å#ú¿º&hXQ~[Ȩ«ÀÀÝQü^?Ö«ç ¨¢úon «?-ýÅÚÑß>à·£¿Øø[KIµEEQ4Q_ÿÐËÿö·ÇôO?ë9ÿ¬ó^ÁùYÂùMøYøgPø·>~¼P´è_ìp@¢Ê»lõÇoãmb|c7/ÃmWÞÜý#pþôÞ$iÄ#µÓAM¼Ò{ ¶²7obäùM Åm¸Î:%ÜïкGLcvM,Ü'x!Ò$}jl©>Õ¾iC<¨qé+AÊ<yì$2§%Â3 ¦K±=½-æy *+ÕdIª/ø¸Çu$aÆ"j ky8éJÊJäÒð «´ÔÆcTÀp¼¡\ECnv©=Ô[©÷ b£ß*eà-ÞQ˱> /.ñ:ûô&!2ÌT¾ÉäwJR¾T]g!Âû>,Í)q*ØJëO 4 ñiCL~Û{óiã@ÈÛ¼ÓòÞ¸QjÈfò:9ÕKDuY³¦]åyÉùnNSVÂç×Ouáê>£<Sâr¡!DT6|Z"/q¯ö Mõ|H ¥C,Ç1Ë5Ê£SzRû.ÛMæKÊ;(DÊç1*GFGpÞúåG0¥gm|é5r(u¥'Å»Ê@íÐDSÛa)¢|lcØ^IKSMõ+ð>ÆPRs:ÄVóÔ,ôPkÔÉ´dG¥\¤ûnühAlºÈó(ò6bêÅ8Ñï2DâU0¦ôlÐ Ux1ç0+î)çnîæîI0JïÎB¼èOZÍ.1ïÝ[ʹÊö<±B·&FíÕl¸fHù]9Õ'Þ qÚjV鱦ôª½I#é â5¤G*¯gÑs5emáÛ¡IÓR=Þ°4õU.AÓ#È.{HK;&Yû3MHȸ"tÿ:¥p&ÄÙºS0RÕD^® t8àKS©ÝQ¼ùÉß1"VZfÆ F£|%IïP~Æ× ¢+Ä6êÌIïRÛ ¾W4÷E*(TH#L(r µÇÒýRg"©=çå µQ\z=-ʸqB z¯y"ÀBÅâr/éz;¦ö$ÅÞSXàîfe¥ÌS Y>kH¢ªfIZÊm÷Ðʶ 'ÉÖá!OE¥"'i s ̤F¨ª¼Bçz¨3#öISÚ[æ"áa/+%aw{'NçÈä5IîAäPI#¾yÐíÊØê°^~÷Û5qJ@Á¥éÈ> $´'ÚFTø²Ñô²½"Ñ6ï©£-U¸Teß!qÚDJègÒ°@ªBF#¯U¬r sN%Î2OÓ! PbµïîK.Ò'R{! CM]åxÑzÒ(<jÕAÞø}ªS%ö¼cSHLÀøw)tEÆ nUû¨Þ~dÔ²eÔB¢+$eÀÇ ß1¾Ë yùæ#ô®,*·S%ÕÊñlBÈvjGj oñä5¾£RTí PAÐ#ÝXDÒÐ'ú© Ï;9NEªõSÍ©}úT¡«Up"ª [HÒf"øò]L =^3Ó¤3 Ö©½WÎ0¬¥1£#}3Å8WL®¤¥ÏC L|©LйÕ"x;sY å`x ÷ oÄH¿JI)*pTn)äÎ ¤ðÏ2ð)AaKð §A¨ó6DTX:¦zÇC¯Å]êLÔJ D #¶¬õXÒP(`@Ä)ö~ óh`Uï 6ALÐ<_j Ì^1Âà $ø óܨÑ*Ù¥ePäÐê¢÷ ³ùcRå{È"9 h1G°kBàDàò4R=V¯þªÄI/Ã@«/ª^âS{¦´H7Âw@®¸¹~Ú1Ma9ÍfJj3À@E¶$ÐýFE^ æd~yeµ'LzÔNE¨x÷&É'57oÃ;îm¨{Ð SE CÜÔÃTM£åEPz' ۸ÃÉC¬±"òU9S*$×@=&|T} ìAø¤¦¥¢{Hµ3ø£+ÉV<»ó\X"´%P h4£Ãº(ÚCî$òñuDìx ºÇ r@(%t&yÝVÔ¨Ü7þh 2é1ÞRïËXDÔRC¡B:Ø ²&Àª+ÐGÛîè>O¥o*¥·5gîÊ¥XïÄ» vô;õÀôAK\ ÐÊT-iXOçHæ K>õÀ#Ö;-!{Ê裪g,Òý&ö ¡·)sxÛ,ÌeåLBjcÊðQ»c*²H¬¦Py< 8Õ@ B2:H£¶('(É^ç{H:úØ%Ó ²xùµET Fè¥Ï£2mY±øNÈÛxÖ¥È[ `L{9h Øcu¶âéZ@zñÝf]kÈ ÈBoÂÆª¢(SAÁ) µ2PL¾®ò̸¨!@üZ²v;AÔÔ m ·Çr¨JÎRÙAT°!k6CH@,íù $rf<ßäéÍ ¾ðþ$mÇÐJa¡(|?µ*ªÛ<òR-à5cX`0`"HC÷É+N72ewZ mx(ª?eÈz-A,acóÌ¥%SÌ$$ÌLêR «mCúÃ;´>ùò*\K3Æë¹¢¦Fe¬ÌðÃã½DQ8+¹_n£ª7¬¡AÂõ ¾¿qâtÄ*kÔJX¦þÔ`¹)#²F?©!ÞW!ä° *(hÀº¯'i @õÄôÌf Àíùx«´±îÊÐ2®ÌÀÇ8äAA?W±9IUÿ6ÉÀÚ%e3ϨÛY"$êïï,ÀW!ìIË{¦ÂR²ü_A}RÐ*V^þú!s y@ÕÂq6\îÆO×¹W+ÁDç\È ±¦Ã< ß¼ ÚCâb5B×nK$°]R÷íoc_Ý>la¶p,äàEª&.ãÌ÷q=ù²0ïI@®âß5à¾4fæÆs÷E ùõUj ÇÀ{ l>+cuCµ ¬õ9¤d¡þ+¯{ ÑIEÆ'Àì$$=jµR© h$.¶Ê0¹VP!¡nÈ)òA¡µ&í7wz G$Ä«¨d (É0)© ÐFNA"