[imp] Small bug in generateMbox

Andrew Morgan morgan at orst.edu
Fri Oct 31 17:07:15 PST 2003


There is a small bug in the generateMbox() function in lib/Folders.php.
The following code is used to generate the "From " message separate line
in an mbox file:

                   $date = date('D M j H:i:s Y', $h->udate);
                   $body .= 'From ' . $from . ' ' . $date . "\n";

Which generates a From line like:

  From foo at oregonstate.edu Tue Sep 2 09:18:39 2003

However, Pine will only "see" the message if the day of the month has a
leading space.  The correct form for the line should be:

  From foo at oregonstate.edu Tue Sep  2 09:18:39 2003

(note the extra space between "Sep" and "2")

I don't see any direct way to do this with php's date() function.  The
only possibility I can come up with for adding a leading space would be to
use a sprintf, maybe like so:

   $date = sprintf('%s %2s %s', date('D M', $h->udate), date('j', $h->udate), date('H:i:s Y', $h->udate));

I've tested this in our production environment and it works correctly.

Could someone apply this to CVS, or suggest a better fix?

	Andy



More information about the imp mailing list