php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

Fix problem with illegal offset error.

Open szymekjanaczek opened this issue 3 years ago • 2 comments

Fixed #224, #98.

Hello @Webklex! I've recently got stuck on a problem with the "illegal offset" error while using your package. After debugging and lots of tests performed on real mailboxes, I realized that we have to remove not-message entries from the results array - because these rows don't have a UID field. The array_search can return false or -1 when can't find searched value. In our case, the array_search returns -1 or (mainly) false as output, and then, the script was trying to add 1 to the result. In PHP false + 1 = 1.

So when the algorithm hadn't been able to find the UID value it thought, that the proper index is 1 (as a result of the false + 1 calculation), which was causing the error.

szymekjanaczek avatar Apr 20 '22 20:04 szymekjanaczek

@Webklex, are you there? Should I change anything?

szymekjanaczek avatar Apr 21 '22 23:04 szymekjanaczek

@Webklex, bump again

szymekjanaczek avatar May 17 '22 13:05 szymekjanaczek

Hi @szymekjanaczek , many thanks for your pull request! Im sorry you had to wait so long.

Best regards,

Webklex avatar Aug 24 '22 18:08 Webklex

@Webklex no problem - glad to hear that! So looking forward to release ;)

szymekjanaczek avatar Aug 24 '22 20:08 szymekjanaczek