ID:               34289
 Updated by:       [EMAIL PROTECTED]
 Reported By:      npeelman at cfl dot rr dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         IMAP related
 Operating System: Windows
 PHP Version:      4.4.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2005-08-28 16:24:18] npeelman at cfl dot rr dot com

Description:
------------
IMAP_UID does not return correct information.

In relation to bugs (7486, 10850, 12954) which seem to be several years
old, as of PHP4.3.4RC3-dev (I am developing GTK apps and this is the
supplied version), also tested with PHP5.0.2:

There appears to be confusion as to the difference between 'Message
No#' and 'Message-Id'.

Message No# is a temporary number and can change as messages are
deleted and added. As an example: you have messages numbering from 1 -
5 and you delete number 3. You will now have a new number 3 and no
number 5 as 4 becomes 3 and 5 becomes 4.

Message-Id is a unique id generated by the server and does not change
over time. Technically speaking, no two messages generated from the
same server should ever have the same Message-Id. This is stored
withing the message headers.

Message No# is more of a general (read loose) pointer where-as
Message-Id is more of a direct pointer to a specific message.

This appears to be a multi-part problem:

#1 imap_uid($imap_stream, $msg_no) returns (as an INT) the 'Message
No#' as defined above. This is conflicting with the very definition of
this command. We already know the Message No# as it is a required
parameter to this function.

#2 The 'Message-Id' as defined in RFC822 is a STRING (possibly
containing more than just numbers), not an INT. This automatically
breaks 'imap_msgno($imap_stream, $uid), 'imap_body', and any other
function that can accept Message-Id, as $uid is expected to be an INT
by these functions, but is not.

#3 The following snippet will retrieve the Message-Id (uid) from the
message $msg_no (Message No# as defined above) if it is present:

$header = imap_headerinfo($imap_stream, $msg_no);
return $header->message_id;

This returns a STRING as defined in RFC822 but is unusable by functions
stated in #2 above.

Excerpt from BUG: #7486
[27 Oct 2000 3:30am CEST] rick at alpinenetworking dot com 
When I call connect to a qmail pop server and call imap_uid all it
does
is return the message number back to me.  It DOES NOT return the uid. 
I
have to call imap_header for that and it is very slow.

[3 May 2001 3:36pm CEST] [EMAIL PROTECTED] 
You might have the wrong idea of what uid is - what do you expect it
to
be? On pop servers the message uid will very likely just _be_ the
message number...

[3 May 2001 5:14pm CEST] [EMAIL PROTECTED] 
From: "Rick Gigger" <[EMAIL PROTECTED]>

All email messages have a unique identifier.  It is a long string that
ususally contains a domiain name or ip address.  It is unique to all
email addresses in the world.  It would be much, much more useful if
imap_uid
would return that instead.

[3 May 2001 5:16pm CEST] [EMAIL PROTECTED] 
That's the Message-ID header. The uid which imap_uid() is intended to
return is a unique identifier of that that message in that mailbox
that
won't change over time. It has nothing to do with the Message-ID
header.
---

As per this last message by [EMAIL PROTECTED]:
Huh? The Message-Id header IS the one that won't change over time, this
entry contradicts itself and it IS the one that imap_uid should be
intending to return. A thought to back this up is that you don't really
need a function to determine a Message No# but you do need one to
determine the Message-Id.


Reproduce code:
---------------
$imap = imap_open($mailbox,$user,$password);
$num_msgs = imap_num_msg($imap);
for ($loop = 1; $loop <= $num_msgs; $loop++)
{
   $uid = imap_uid($imap, $loop);
   echo "Message: $loop -> $uid \n\r";
   $header = imap_headerinfo($this->imap, $loop);
   echo "Msg UID: $loop -> $header->message_id \n\r";
   $body = imap_body($imap, $uid, FT_UID);
   echo "Msg body: \n\r $body \n\r\n\r";
}
 

Expected result:
----------------
For $num_msgs = 1:

Message: 1 ->
<[EMAIL PROTECTED]>
Msg UID: 1 ->
<[EMAIL PROTECTED]>
Msg body:
Message body here...


Actual result:
--------------
For $num_msgs = 1:

Message: 1 -> 1
Msg UID: 1 ->
<[EMAIL PROTECTED]>
Msg body:
Warning: imap_body(): Bad message number in path:\to\source.php on line
# (line containing imap_body() function)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34289&edit=1

Reply via email to