ddeboer / imap

Object-oriented, fully tested PHP IMAP library
MIT License
888 stars 253 forks source link

imap_sort(): Argument #3 ($reverse) #544

Open Boffice opened 2 years ago

Boffice commented 2 years ago
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
Slamdunk commented 2 years ago

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

Can you reproduce the bug in a test?