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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 48 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 10:01:31 2024 UTC