barbushin / php-imap

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)
MIT License
1.65k stars 459 forks source link

BUG: An argument $reverse of method \PhpImap\Imap::sort() has type boolean from PHP version 8 only #659

Closed alebedev80 closed 2 years ago

alebedev80 commented 2 years ago

Environment (please complete the following information):

Describe the bug

The $reverse variable type conversion from boolean to integer has been removed in this commit, but imap_open() before PHP version 8 only accepts integer type. Thus, in PHP 7 this code ends with the error:

imap_sort() expects parameter 3 to be int, bool given at /var/www/virtual/site/htdocs/vendor/php-imap/php-imap/src/PhpImap/Imap.php:934

Also i found strange assignment in \PhpImap\Imap::sort():

        /** @var int */
        $criteria = $criteria;

I've added PHP version detection and removed legacy code.

Please review it.

Thank you!

alebedev80 commented 2 years ago

@barbushin @rmontagud @Theaxiom @hexathos @JellyBellyDev hey somebody please review and merge PR!

mattyhansen commented 2 years ago

@barbushin @rmontagud @Theaxiom @hexathos @JellyBellyDev @alebedev80

The following commit from 4.3.0 is causing this "imap_sort() expects parameter 3 to be int, bool given" error:

https://github.com/barbushin/php-imap/commit/2cd5d0bcf4500f4cc70559a103d65a72b512700b

image

alebedev80 commented 2 years ago

@mattyhansen seems this repo abandoned i plan to rid off it from my project

JellyBellyDev commented 2 years ago

@alebedev80 sorry but I am not one of the maintainers, a long time ago I contributed a PR but I have no power over this repo. good luck

alebedev80 commented 2 years ago

@Sebi94nbg i've fixed a code, please review it again.

Sebbo94BY commented 2 years ago

Released in version 4.5.2.