$boundary = md5(uniqid($_SERVER['REQUEST_TIME']));
$boundary for "multipart/alternative" and $boundary for "multipart/mixed" are equal

We ask me "WHY?"
I don't know!

php 5.4.17
win xp

We need $more_entropy!

function mimemail_multipart_body($parts, $content_type = 'multipart/mixed; charset=utf-8', $sub_part = FALSE) {
-  $boundary = md5(uniqid($_SERVER['REQUEST_TIME']));
+  $boundary = md5(uniqid($_SERVER['REQUEST_TIME'], true));

Comments

dmitriy.trt’s picture

From the PHP manual discussion:

As others below note, without prefix and without "added entropy", this function simply returns the UNIX timestamp with added microsecond counter as a hex number; it's more or less just microtime(), in hexit form.

[...]

Also worth to note is that since microtime() only works on systems that have gettimeofday() present, which Windows natively DOES NOT, uniqid() might yield just the single-second-resolution UNIX timestamp in a Windows environment.

sgabe’s picture

I can't reproduce this, the boundaries seem to be fine.

Punk_UnDeaD’s picture

but Drupal must work in Windows XP to

sgabe’s picture

Title: $boundary is not unique » Boundaries are not unique on Windows
Status: Active » Fixed
StatusFileSize
new478 bytes
new620 bytes

The attached patches have been committed to both branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.