1--TEST-- 2Test imap_reopen() 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$mailbox_suffix = 'imapreopenwithclexpunge'; 16 17// set up temp mailbox with 3 messages 18$stream_id = setup_test_mailbox($mailbox_suffix , 3, $mailbox); 19 20var_dump(imap_reopen($stream_id, IMAP_DEFAULT_MAILBOX . '.' . IMAP_MAILBOX_PHPT_PREFIX . $mailbox_suffix, flags: CL_EXPUNGE)); 21 22// mark messages in inbox for deletion 23for ($i = 1; $i < 4; $i++) { 24 imap_delete($stream_id, $i); 25} 26 27echo "\n-- Call to imap_close() --\n"; 28var_dump( imap_close($stream_id) ); 29 30// check that CL_EXPUNGE in previous imap_reopen() call worked 31$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD); 32echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n"; 33 34// Close connection 35var_dump( imap_close($stream_id) ); 36?> 37--CLEAN-- 38<?php 39$mailbox_suffix = 'imapreopenwithclexpunge'; 40require_once(__DIR__.'/setup/clean.inc'); 41?> 42--EXPECTF-- 43Create a temporary mailbox and add 3 msgs 44New mailbox created 45bool(true) 46 47-- Call to imap_close() -- 48bool(true) 49There are now 0 msgs in mailbox '%sINBOX.phpttestimapreopenwithclexpunge' 50bool(true) 51