Req #5617 [NEW]: Explain that order of method calls matter
| From: | me at thomaskeller dot biz | Date: | Thu, 06 Oct 2005 15:47:55 +0000 |
| Subject: | Req #5617 [NEW]: Explain that order of method calls matter | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-6981@lists.php.net to get a copy of this message | ||
From: me at thomaskeller dot biz
Operating system: Windows 2000
PHP version: 4.3.11
Package: Documentation
Bug Type: Feature/Change Request
Bug description: Explain that order of method calls matter
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 bug report at http://pear.php.net/bugs/bug.php?id=5617&edit=1
--