xref: /PHP-8.2/ext/imap/tests/imap_open_error.phpt (revision 09237f61)
1--TEST--
2imap_open() ValueErrors
3--CREDITS--
4Paul Sohier
5#phptestfest utrecht
6--EXTENSIONS--
7imap
8--SKIPIF--
9<?php
10require_once(__DIR__.'/setup/skipif.inc');
11if (getenv("SKIP_ASAN")) die("skip leak sanitizer crashes");
12?>
13--FILE--
14<?php
15
16echo "Checking with incorrect parameters\n" ;
17imap_open('', '', '');
18
19try {
20    imap_open('', '', '', -1);
21} catch (\ValueError $e) {
22    echo $e->getMessage() . \PHP_EOL;
23}
24
25try {
26    imap_open('', '', '', 0, -1);
27} catch (\ValueError $e) {
28    echo $e->getMessage() . \PHP_EOL;
29}
30
31?>
32--EXPECTF--
33Checking with incorrect parameters
34
35Warning: imap_open(): Couldn't open stream  in %s on line %d
36imap_open(): Argument #4 ($flags) must be a bitmask of the OP_* constants, and CL_EXPUNGE
37imap_open(): Argument #5 ($retries) must be greater than or equal to 0
38
39Notice: PHP Request Shutdown: Can't open mailbox : no such mailbox (errflg=2) in Unknown on line 0
40