#19402 [Opn->Csd]: [patch] imap_mail_compose can't add arbitrary parameters to Content-Type

From: Date: Wed, 18 Sep 2002 12:00:33 +0000
Subject: #19402 [Opn->Csd]: [patch] imap_mail_compose can't add arbitrary parameters to Content-Type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19629@lists.php.net to get a copy of this message
ID: 19402 Updated by: kalowsky@php.net Reported By: kevin.way@overtone.org -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: FreeBSD PHP Version: 4.2.3 New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Now I'm going to sleep.... Previous Comments: ------------------------------------------------------------------------ [2002-09-14 08:12:35] kevin.way@overtone.org 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 this bug report at http://bugs.php.net/?id=19402&edit=1

« previous php.bugs (#19629) next »