php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13373 imap_fetchstructure() does not return $struct->type for text types
Submitted: 2001-09-21 07:42 UTC Modified: 2002-12-12 21:43 UTC
From: rfinnie at kefta dot com Assigned:
Status: Closed Package: IMAP related
PHP Version: 4.3.0RC2 OS: FreeBSD 4.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rfinnie at kefta dot com
New email:
PHP Version: OS:

 

 [2001-09-21 07:42 UTC] rfinnie at kefta dot com
Bug 2181 is marked closed, but last comment indicates it should be re-opened (sorry, I'm not the opener of 2181).  This would be what $struct->type would normally be used for:

    $types = array(
      0 => "TEXT",
      1 => "MULTIPART",  
      2 => "MESSAGE",
      3 => "APPLICATION",
      4 => "AUDIO",
      5 => "IMAGE",
      6 => "VIDEO",
      7 => "OTHER"
    );
    if($struct->type) {
      $type = $types[$struct->type];
    } else {
      $type = "UNKNOWN";
    }

$struct->type will always evaluate as false, but you can see from serializing the struct object that the type isn't being set at all.  This probably should be fixed either way.

On the other hand, can we always assume that if $struct->type is false/null/whatever, it is a text part?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-24 23:12 UTC] kalowsky@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2002-12-11 15:55 UTC] rfinnie at kefta dot com
This is still an issue.
 [2002-12-12 21:43 UTC] vlad@php.net
The last comment on 2181 indicated that it's fixed.
I verified that it works.

Consider the following part of var_dump output on an object that contained text/plain part:

[snip]
      ["parts"]=>
      array(2) {
        [0]=>
        object(stdClass)(12) {
          ["type"]=>
          int(0)
          ["encoding"]=>
          int(4)
          ["ifsubtype"]=>
          int(1)
          ["subtype"]=>
          string(5) "PLAIN"
          ["ifdescription"]=>
[snip]


Notice the int(0) for type.
Please, note that types > 7 will result in undefined value. 

If you have further questions, please send me a copy of MIME header of the email part in question (or, better, the whole message if it's not a secret) and re-open this bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 18:01:30 2024 UTC