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