php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #19402 [patch] imap_mail_compose can't add arbitrary parameters to Content-Type
Submitted: 2002-09-14 08:12 UTC Modified: 2002-09-18 07:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: kevin dot way at overtone dot org Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.3 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kevin dot way at overtone dot org
New email:
PHP Version: OS:

 

 [2002-09-14 08:12 UTC] kevin dot way at overtone dot 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);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-18 07:00 UTC] kalowsky@php.net
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....
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 09:01:28 2025 UTC