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