1--TEST--
2imap_fetchstructure() errors: ValueError and Warnings
3--SKIPIF--
4<?php
5require_once(__DIR__.'/setup/skipif.inc');
6?>
7--FILE--
8<?php
9
10require_once(__DIR__.'/setup/imap_include.inc');
11
12$imap_mail_box = setup_test_mailbox("imapfetchstructureerrors", 0);
13
14try {
15    imap_fetchstructure($imap_mail_box, -1);
16} catch (\ValueError $e) {
17    echo $e->getMessage() . \PHP_EOL;
18}
19try {
20    imap_fetchstructure($imap_mail_box, 1, -1);
21} catch (\ValueError $e) {
22    echo $e->getMessage() . \PHP_EOL;
23}
24
25// Access not existing
26var_dump(imap_fetchstructure($imap_mail_box, 255));
27var_dump(imap_fetchstructure($imap_mail_box, 255, FT_UID));
28
29imap_close($imap_mail_box);
30
31?>
32--CLEAN--
33<?php
34$mailbox_suffix = 'imapfetchstructureerrors';
35require_once(__DIR__ . '/setup/clean.inc');
36?>
37--EXPECTF--
38Create a temporary mailbox and add 0 msgs
39New mailbox created
40imap_fetchstructure(): Argument #2 ($message_num) must be greater than 0
41imap_fetchstructure(): Argument #3 ($flags) must be FT_UID or 0
42
43Warning: imap_fetchstructure(): Bad message number in %s on line %d
44bool(false)
45
46Warning: imap_fetchstructure(): UID does not exist in %s on line %d
47bool(false)
48