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