#19402 [NEW]: [patch] imap_mail_compose can't add arbitrary parameters to Content-Type
| From: | kevin dot way at overtone dot org | Date: | Sat, 14 Sep 2002 13:12:35 +0000 |
| Subject: | #19402 [NEW]: [patch] imap_mail_compose can't add arbitrary parameters to Content-Type | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-19343@lists.php.net to get a copy of this message | ||
From: kevin.way@overtone.org
Operating system: FreeBSD
PHP version: 4.2.3
PHP Bug Type: Feature/Change Request
Bug description: [patch] imap_mail_compose can't add arbitrary parameters to Content-Type
imap_mail_compose can add arbitrary parameters to the disposition, but not
the type. Here's a patch:
--- php_imap.c.orig Sun Aug 25 21:58:31 2002
+++ php_imap.c Fri Sep 13 23:46:05 2002
@@ -3000,6 +3000,23 @@
tmp_param->next = bod->parameter;
bod->parameter = tmp_param;
}
+ if (zend_hash_find(Z_ARRVAL_PP(data), "type.parameters",
sizeof("type.parameters"), (void **) &pvalue)== SUCCESS) {
+ if(Z_TYPE_PP(pvalue) == IS_ARRAY) {
+ disp_param = tmp_param = NULL;
+ while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue),
(void **) &disp_data) == SUCCESS) {
+ disp_param = mail_newbody_parameter();
+ zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key,
&ind, 0);
+ disp_param->attribute = key;
+ convert_to_string_ex(disp_data);
+ disp_param->value = (char *)
fs_get(Z_STRLEN_PP(disp_data) + 1);
+ memcpy(disp_param->value, Z_STRVAL_PP(disp_data),
Z_STRLEN_PP(disp_data) + 1);
+
zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
+ disp_param->next = tmp_param;
+ tmp_param = disp_param;
+ }
+ bod->parameter = disp_param;
+ }
+ }
if (zend_hash_find(Z_ARRVAL_PP(data), "subtype",
sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
@@ -3085,6 +3102,23 @@
tmp_param->attribute = "CHARSET";
tmp_param->next = bod->parameter;
bod->parameter = tmp_param;
+ }
+ if (zend_hash_find(Z_ARRVAL_PP(data), "type.parameters",
sizeof("type.parameters"), (void **) &pvalue)== SUCCESS) {
+ if(Z_TYPE_PP(pvalue) == IS_ARRAY) {
+ disp_param = tmp_param = NULL;
+ while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue),
(void **) &disp_data) == SUCCESS) {
+ disp_param = mail_newbody_parameter();
+ zend_hash_get_current_key(Z_ARRVAL_PP(pvalue),
&key, &ind, 0);
+ disp_param->attribute = key;
+ convert_to_string_ex(disp_data);
+ disp_param->value = (char *)
fs_get(Z_STRLEN_PP(disp_data) + 1);
+ memcpy(disp_param->value, Z_STRVAL_PP(disp_data),
Z_STRLEN_PP(disp_data) + 1);
+
zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
+ disp_param->next = tmp_param;
+ tmp_param = disp_param;
+ }
+ bod->parameter = disp_param;
+ }
}
if (zend_hash_find(Z_ARRVAL_PP(data), "subtype",
sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
--
Edit bug report at http://bugs.php.net/?id=19402&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19402&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19402&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19402&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19402&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19402&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19402&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19402&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19402&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19402&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19402&r=globals