1
0
mirror of https://github.com/php/php-src.git synced 2026-04-19 14:01:01 +02:00
Files
archived-php-src/ext/imap/tests/bug64076.phpt
Christoph M. Becker db8bf0a9e0 Fix #64076: imap_sort() does not return FALSE on failure
If unsupported `$search_criteria` are passed to `imap_sort()`, the
function returns an empty array, but there is also an error on the
libc-client error stack ("Unknown search criterion: UNSUPPORTED
(errflg=2)").  If, on the other hand, unsupported `$criteria` or
unsupported `$flags` are passed, the function returns `false`.  We
solve this inconsistency by returning `false` for unsupported
`$search_criteria` as well.

Closes GH-6332.
2020-10-13 19:37:05 +02:00

24 lines
562 B
PHP

--TEST--
Bug #64076 (imap_sort() does not return FALSE on failure)
--SKIPIF--
<?php
require_once __DIR__ . '/skipif.inc';
?>
--FILE--
<?php
require_once __DIR__ . '/imap_include.inc';
$stream = setup_test_mailbox('', 2);
imap_errors(); // clear error stack
var_dump(imap_sort($stream, SORTFROM, 0, 0, 'UNSUPPORTED SEARCH CRITERIUM'));
var_dump(imap_errors() !== false);
?>
--CLEAN--
<?php
require_once __DIR__ . '/clean.inc';
?>
--EXPECT--
Create a temporary mailbox and add 2 msgs
.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created
bool(false)
bool(true)