$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
Summary
Above code worked fine on php 7.4 but on php 8 i get the error: