diff --git a/NEWS b/NEWS index fca1a2a1478..3f7c5c8e3c7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2020, PHP 7.4.13 +- IMAP: + . Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb) 29 Oct 2020, PHP 7.4.12 diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 6a7cfe7037e..fde64aeae18 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -3199,6 +3199,9 @@ PHP_FUNCTION(imap_sort) } else { spg = mail_newsearchpgm(); } + if (spg == NIL) { + RETURN_FALSE; + } mypgm = mail_newsortpgm(); mypgm->reverse = rev; diff --git a/ext/imap/tests/bug64076.phpt b/ext/imap/tests/bug64076.phpt new file mode 100644 index 00000000000..ccafcfe2513 --- /dev/null +++ b/ext/imap/tests/bug64076.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #64076 (imap_sort() does not return FALSE on failure) +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +Create a temporary mailbox and add 2 msgs +.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created +bool(false) +bool(true)