php-imap
php-imap copied to clipboard
Fix problem with illegal offset error.
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.
@Webklex, are you there? Should I change anything?
@Webklex, bump again
Hi @szymekjanaczek , many thanks for your pull request! Im sorry you had to wait so long.
Best regards,
@Webklex no problem - glad to hear that! So looking forward to release ;)