Skip to content

Commit d9058b6

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #64076: imap_sort() does not return FALSE on failure
2 parents 8fd8a1b + db8bf0a commit d9058b6

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2020, PHP 7.4.13
44

5+
- IMAP:
6+
. Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb)
57

68
29 Oct 2020, PHP 7.4.12
79

ext/imap/php_imap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,6 +3199,9 @@ PHP_FUNCTION(imap_sort)
31993199
} else {
32003200
spg = mail_newsearchpgm();
32013201
}
3202+
if (spg == NIL) {
3203+
RETURN_FALSE;
3204+
}
32023205

32033206
mypgm = mail_newsortpgm();
32043207
mypgm->reverse = rev;

ext/imap/tests/bug64076.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Bug #64076 (imap_sort() does not return FALSE on failure)
3+
--SKIPIF--
4+
<?php
5+
require_once __DIR__ . '/skipif.inc';
6+
?>
7+
--FILE--
8+
<?php
9+
require_once __DIR__ . '/imap_include.inc';
10+
$stream = setup_test_mailbox('', 2);
11+
imap_errors(); // clear error stack
12+
var_dump(imap_sort($stream, SORTFROM, 0, 0, 'UNSUPPORTED SEARCH CRITERIUM'));
13+
var_dump(imap_errors() !== false);
14+
?>
15+
--CLEAN--
16+
<?php
17+
require_once __DIR__ . '/clean.inc';
18+
?>
19+
--EXPECT--
20+
Create a temporary mailbox and add 2 msgs
21+
.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created
22+
bool(false)
23+
bool(true)

0 commit comments

Comments
 (0)