imap icon indicating copy to clipboard operation
imap copied to clipboard

imap_sort(): Argument #3 ($reverse)

Open Boffice opened this issue 3 years ago • 1 comments

Q A
ddeboer/imap version 1.14.0
PHP version PHP 8.0.22

Summary

$today = new DateTimeImmutable();
        $thirtyDaysAgo = $today->sub(new DateInterval('P2D'));

        $messages = $mailbox->getMessages(
            new Ddeboer\Imap\Search\Date\Since($thirtyDaysAgo),
            \SORTDATE, // Sort criteria
            true // Descending order
        );

Above code worked fine on php 7.4 but on php 8 i get the error:

An uncaught Exception was encountered

Type: TypeError

Message: imap_sort(): Argument #3 ($reverse) must be of type bool, int given

Filename: /var/www/public_html/crm/application/vendor/ddeboer/imap/src/Mailbox.php

Line Number: 172

Boffice avatar Aug 13 '22 22:08 Boffice

That's unexpected, https://github.com/ddeboer/imap/pull/483 should already have fixed this.

Can you reproduce the bug in a test?

Slamdunk avatar Aug 26 '22 08:08 Slamdunk