1--TEST--
2Test imap_open() using the CL_EXPUNGE flag
3--SKIPIF--
4<?php
5require_once(__DIR__.'/setup/skipif.inc');
6?>
7--FILE--
8<?php
9
10// include file for required variables in imap_open()
11require_once(__DIR__.'/setup/imap_include.inc');
12
13// set up temp mailbox with 3 messages
14$stream_id = setup_test_mailbox('imapopenwithclexpunge', 3, $mailbox, flags: CL_EXPUNGE);
15
16// mark messages in inbox for deletion
17for ($i = 1; $i < 4; $i++) {
18    imap_delete($stream_id, $i);
19}
20
21echo "\n-- Call to imap_close() --\n";
22var_dump( imap_close($stream_id) );
23
24// check that CL_EXPUNGE in previous imap_open() call worked
25$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
26echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
27
28// Close connection
29var_dump( imap_close($stream_id) );
30?>
31--CLEAN--
32<?php
33$mailbox_suffix = 'imapopenwithclexpunge';
34require_once(__DIR__.'/setup/clean.inc');
35?>
36--EXPECTF--
37Create a temporary mailbox and add 3 msgs
38New mailbox created
39
40-- Call to imap_close() --
41bool(true)
42There are now 0 msgs in mailbox '%sINBOX.phpttestimapopenwithclexpunge'
43bool(true)
44