From:             richard at dominion-web dot com
Operating system: Linux
PHP version:      4.3.9
PHP Bug Type:     IMAP related
Bug description:  imap_fetchstructure() different on POP3 to IMAP4

Description:
------------
If I run an imap_fetchstructure() on POP3 on a multipart/mixed message
with a file attachment I get

object(stdClass)(12) {
  ["type"]=>
  int(1)
  ["encoding"]=>
  int(0)
  ["ifsubtype"]=>
  int(1)
  ["subtype"]=>
  string(5) "MIXED"
  ["ifdescription"]=>
  int(0)
  ["ifid"]=>
  int(0)
  ["bytes"]=>
  int(337991)
  ["ifdisposition"]=>
  int(0)
  ["ifdparameters"]=>
  int(0)
  ["ifparameters"]=>
  int(1)
  ["parameters"]=>
  array(1) {
    [0]=>
    object(stdClass)(2) {
      ["attribute"]=>
      string(8) "BOUNDARY"
      ["value"]=>
      string(41) "----=_NextPart_000_004B_01C4B881.82B4DE80"
    }
  }
  ["parts"]=>
  array(2) {
    [0]=>
    object(stdClass)(12) {
      ["type"]=>
      int(0)
      ["encoding"]=>
      int(0)
      ["ifsubtype"]=>
      int(1)
      ["subtype"]=>
      string(5) "PLAIN"
      ["ifdescription"]=>
      int(0)
      ["ifid"]=>
      int(0)
      ["lines"]=>
      int(18)
      ["bytes"]=>
      int(439)
      ["ifdisposition"]=>
      int(0)
      ["ifdparameters"]=>
      int(0)
      ["ifparameters"]=>
      int(1)
      ["parameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(7) "CHARSET"
          ["value"]=>
          string(10) "iso-8859-1"
        }
      }
    }
    [1]=>
    object(stdClass)(13) {
      ["type"]=>
      int(5)
      ["encoding"]=>
      int(3)
      ["ifsubtype"]=>
      int(1)
      ["subtype"]=>
      string(4) "JPEG"
      ["ifdescription"]=>
      int(0)
      ["ifid"]=>
      int(0)
      ["bytes"]=>
      int(337122)
      ["ifdisposition"]=>
      int(1)
      ["disposition"]=>
      string(10) "ATTACHMENT"
      ["ifdparameters"]=>
      int(1)
      ["dparameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(8) "FILENAME"
          ["value"]=>
          string(14) "email left.jpg"
        }
      }
      ["ifparameters"]=>
      int(1)
      ["parameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(4) "NAME"
          ["value"]=>
          string(14) "email left.jpg"
        }
      }
    }
  }
}

If I run exactly the same code under an IMAP4 extension I get

object(stdClass)(11) {
  ["type"]=>
  int(1)
  ["encoding"]=>
  int(0)
  ["ifsubtype"]=>
  int(1)
  ["subtype"]=>
  string(5) "MIXED"
  ["ifdescription"]=>
  int(0)
  ["ifid"]=>
  int(0)
  ["ifdisposition"]=>
  int(0)
  ["ifdparameters"]=>
  int(0)
  ["ifparameters"]=>
  int(0)
  ["parameters"]=>
  object(stdClass)(0) {
  }
  ["parts"]=>
  array(1) {
    [0]=>
    object(stdClass)(12) {
      ["type"]=>
      int(0)
      ["encoding"]=>
      int(0)
      ["ifsubtype"]=>
      int(1)
      ["subtype"]=>
      string(5) "PLAIN"
      ["ifdescription"]=>
      int(0)
      ["ifid"]=>
      int(0)
      ["lines"]=>
      int(19)
      ["bytes"]=>
      int(441)
      ["ifdisposition"]=>
      int(0)
      ["ifdparameters"]=>
      int(0)
      ["ifparameters"]=>
      int(1)
      ["parameters"]=>
      array(1) {
        [0]=>
        object(stdClass)(2) {
          ["attribute"]=>
          string(7) "charset"
          ["value"]=>
          string(10) "iso-8859-1"
        }
      }
    }
  }
}

It doesn't seem to be c-client related as it seems to work connecting to
other mail servers from the same web server, however connecting to this
particular exim server produces this problem.

I am retrieving message UID's and not sequence IDs and the actual body of
the message is displayed correctly, just the attachment missing.

The email source is as follows (headers changed to protect details and
image condensed on purpose for size but I have kept the exact structure
and number of carriage returns)

Subject: Test Email Attachment.
Date: Fri, 22 Oct 2004 21:53:05 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
        boundary="----=_NextPart_000_004B_01C4B881.82B4DE80"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Importance: Normal



This is a multi-part message in MIME format.

------=_NextPart_000_004B_01C4B881.82B4DE80
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Body of message
--------------------------------------------------------
Signature
-------------------------------------------------------- 
------=_NextPart_000_004B_01C4B881.82B4DE80
Content-Type: image/jpeg;
        name="email left.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
        filename="email left.jpg"

[snip]base64 encoded jpeg[/snip]

------=_NextPart_000_004B_01C4B881.82B4DE80--




Reproduce code:
---------------
$structure = imap_fetchstructure($mailbox, $msgid, FT_UID);

Expected result:
----------------
Retrieves body of message and one image file attachment in the structure

Actual result:
--------------
Retrieves body of message and no image files attachments in the structure

-- 
Edit bug report at http://bugs.php.net/?id=30538&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30538&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30538&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30538&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30538&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30538&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30538&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30538&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30538&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30538&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30538&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30538&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30538&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30538&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30538&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30538&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30538&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30538&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30538&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30538&r=mysqlcfg

Reply via email to