summaryrefslogtreecommitdiff
path: root/ext/imap/tests/imap_fetchmime_errors.phpt
blob: d99168a7082c97a5391a194c01e4efa00b18a66b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--TEST--
imap_fetchmime() errors: ValueError and Warnings
--SKIPIF--
<?php
require_once(__DIR__.'/setup/skipif.inc');
?>
--FILE--
<?php

require_once(__DIR__.'/setup/imap_include.inc');

$imap_mail_box = setup_test_mailbox("imapfetchmimeerrors", 0);

$section = '';

try {
    imap_fetchmime($imap_mail_box, -1, $section);
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}
try {
    imap_fetchmime($imap_mail_box, 1, $section, -1);
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

// Access not existing
var_dump(imap_fetchmime($imap_mail_box, 255, $section));
var_dump(imap_fetchmime($imap_mail_box, 255, $section, FT_UID));

imap_close($imap_mail_box);

?>
--CLEAN--
<?php
$mailbox_suffix = 'imapfetchmimeerrors';
require_once(__DIR__ . '/setup/clean.inc');
?>
--EXPECTF--
Create a temporary mailbox and add 0 msgs
New mailbox created
imap_fetchmime(): Argument #2 ($message_num) must be greater than 0
imap_fetchmime(): Argument #4 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL

Warning: imap_fetchmime(): Bad message number in %s on line %d
bool(false)

Warning: imap_fetchmime(): UID does not exist in %s on line %d
bool(false)