javanile / php-imap2

PHP IMAP with OAUTH2
https://php-imap2.javanile.org/
GNU General Public License v3.0
48 stars 28 forks source link

Messages fetched by UID don't have $messageNum as key #33

Open pjio opened 1 year ago

pjio commented 1 year ago

First thanks to everyone involved in this project!

About the problem: I'm using this library alongside with https://github.com/ddeboer/imap, which uses the UID to identify messages. In Roundcube\ImapClient::fetch() the sequence-number (variable $id) is used as the key in $result, even when $is_uid is set to true. In Javanile\Imap2\Message depending on $flags the $messageNum-parameter could either be the sequence-number or the UID. Therefore some methods fail to access the result.

What I've changed: ~array_pop() is used to retrieve the message from the array and should work with sequence-numbers and UID.~ If FT_UID is set, $messages will have the uid as the key in the affected functions (no change was required to Roundcube).

How I've tested it: I fetched mails from Outlook365 via OAuth2 and by UID successfully with this change.

Possibly related: https://github.com/javanile/php-imap2/issues/15 https://github.com/javanile/php-imap2/issues/18

IZSkiSurfer commented 1 year ago

Also check #32 This is a design flaw by roundcubes library. Check my ticket for how to handle it the "roundcube way"

pjio commented 1 year ago

@IZSkiSurfer I've changed the PR to the "Roundcube way".

image

This is more explicit and should have no side effects.

IZSkiSurfer commented 1 year ago

Thanks @pjio your fix looks fine and dandy ;) I guess the tickets could be closed or marked as fixed with the next version.