Req #5617 [Com]: Explain that order of method calls get() and headers() of Mail_mime matter
| From: | ssttoo at gmail dot com | Date: | Thu, 24 Nov 2005 05:34:32 +0000 |
| Subject: | Req #5617 [Com]: Explain that order of method calls get() and headers() of Mail_mime matter | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-7194@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=5617&edit=1
ID: 5617
Comment by: ssttoo at gmail dot com
Reported By: me at thomaskeller dot biz
Status: Open
Id: 5617
Type: Feature/Change Request
Package: Documentation
Operating System: Windows 2000
PHP Version: 4.3.11
New Comment:
This _is_ exmplained (twice) on the Mail_Mime::headers() page
http://pear.php.net/manual/en/package.mail.mail-mime.headers.php
But maybe it's still a good idea to mention it in the Mail_mime example
code.
Previous Comments:
------------------------------------------------------------------------
[2005-10-06 11:48:55] me at thomaskeller dot biz
changed summary
------------------------------------------------------------------------
[2005-10-06 11:47:55] me at thomaskeller dot biz
Description:
------------
The example for Mail_mime contains this code snippet:
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
While both function calls don't seem to be dependent
from a first view, they are. After I crawled through the
sourcecode for over an hour I found that get() calls
Mail_mimePart's encode() where boundaries for certain
parts of the email are dynamically created. If you now
retrieve the headers before this encoding action, you
won't gain the needed "Content-type: multipart/alternative;
boundary=\"some_random_boundary\"" header and - effectively - the
example doesn't work out at all (both mime parts are
displayed under another).
IMHO the docs should at least state that it won't work
the other way around, better would be to change the
implementation so that headers() returns an error as long
as encode() or get() isn't called. Something along this
line.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=5617&edit=1