summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2002-03-27 20:39:27 +0000
committerDerick Rethans <derick@php.net>2002-03-27 20:39:27 +0000
commit408a8dfeadf833fac7feba1dd9d5a171a7fd40a5 (patch)
tree62209044a42d9b62e3f7b5cac7d3515afb50b895
parent9080907ed7dab81caa3e568e4ba4f02372d50a44 (diff)
downloadphp-git-408a8dfeadf833fac7feba1dd9d5a171a7fd40a5.tar.gz
- MFH for multiple To: lines
-rwxr-xr-xext/mailparse/rfc2045.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/ext/mailparse/rfc2045.c b/ext/mailparse/rfc2045.c
index 0cd002f2ac..8459ea4e58 100755
--- a/ext/mailparse/rfc2045.c
+++ b/ext/mailparse/rfc2045.c
@@ -758,7 +758,33 @@ static void do_header(struct rfc2045 *p)
val++;
while(isspace(*val))
val++;
- add_assoc_string(p->headerhash, t, val, 1);
+
+ if (strcmp(t, "to") == 0 || strcmp(t, "cc") == 0) {
+ /* join multiple To: or Cc: lines together, so that
+ * those addresses are not silently ignored by scripts
+ * that do not parse headers manually */
+ zval **existing = NULL;
+
+ if (SUCCESS == zend_hash_find(Z_ARRVAL_P(p->headerhash), t, strlen(t)+1, (void**)&existing)) {
+ int newlen;
+ char *newstr;
+
+ newlen = strlen(val) + Z_STRLEN_PP(existing) + 3;
+ newstr = emalloc(newlen);
+
+ strcpy(newstr, Z_STRVAL_PP(existing));
+ strcat(newstr, ", ");
+ strcat(newstr, val);
+
+ add_assoc_string(p->headerhash, t, newstr, 0);
+
+ } else {
+ add_assoc_string(p->headerhash, t, val, 1);
+ }
+ } else {
+ add_assoc_string(p->headerhash, t, val, 1);
+ }
+
}
if (strcmp(t, "mime-version") == 0)
{