Req #5617 [Opn]: Explain that order of method calls get() and headers() of Mail_mime matter

From: Date: Thu, 06 Oct 2005 15:48:55 +0000
Subject: Req #5617 [Opn]: 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-6982@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 User updated by: me at thomaskeller dot biz -Summary: Explain that order of method calls matter 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: changed summary Previous Comments: ------------------------------------------------------------------------ [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

« previous php.pear.doc (#6982) next »