Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.11

Request #15913 Attachments Memory Optimization
Submitted: 2009-02-18 19:45 UTC
From: erika Assigned: alec
Status: Closed Package: Mail_Mime
PHP Version: 5.2.4 OS: Linux
Roadmaps: 1.5.3    

 [2009-02-18 19:45 UTC] erika (Erika Deboz Hieux)
Description: ------------ This patch tends to optimize the memory used by the method "encode" of the class "Mail_mimePart". It avoids to having attachments data duplicated in memory. So it is not a bug, but only an enhancement... :-) Test script: --------------- <?php include('Mail.php'); include('Mail/mime.php'); $text = 'Text version of email'; $html = '<html><body>HTML version of email</body></html>'; $file = '/tmp/phpMfQ2rE'; // filesize: 3406310 bytes $crlf = "\n"; $hdrs = array( 'From' => '', 'Subject' => 'Test mime message' ); $mime = new Mail_mime($crlf); $mime->setTXTBody($text); $mime->setHTMLBody($html); $mime->addAttachment($file, 'text/plain'); //do not ever try to call these lines in reverse order $body = $mime->get(); $hdrs = $mime->headers($hdrs); $mail =& Mail::factory('mail'); $mail->send('', $hdrs, $body); ?> Expected result: ---------------- Actual result: -------------- peak memory usage without patch : about 22 Mb peak memory usage with patch : about 17 Mb


 [2009-02-21 14:22 UTC] doconnor (Daniel O'Connor)
-Type: Bug +Type: Feature/Change Request
 [2009-07-25 10:06 UTC] doconnor (Daniel O'Connor)
Erika, would you mind doing a new version of this patch? It's out of date compared to latest SVN trunk.
 [2009-07-25 10:07 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
 [2009-07-26 15:47 UTC] erika (Erika Deboz Hieux)
The following patch has been added/updated: Patch Name: mimePart.php.patch Revision: 1248605278 URL:
 [2009-12-07 08:02 UTC] codeforfood (Chris White)
Have you forgotten about this patch? Please don't let another 5 months elapse and reviewing it again and saying "sorry, could you please update it to the latest SVN." This patch was up-to-date when it was submitted on February 18th. Then you respond on July 25th with a request for an updated diff file, which Erika kindly provides in just ONE day. And look at it now, already 5 months have passed again. We're in December now. I just had to comment on this. This kind of thing can really discourage contributing.
 [2009-12-18 13:20 UTC] alec (Aleksander Machniak)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2009-12-18 16:26 UTC] alec (Aleksander Machniak)
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: alec
 [2009-12-18 19:49 UTC] alec (Aleksander Machniak)
-Roadmap Versions: +Roadmap Versions: 1.5.3