1--TEST-- 2Test imap_fetchheader() function : usage variations - FT_UID option 3--SKIPIF-- 4<?php 5require_once(dirname(__FILE__).'/skipif.inc'); 6?> 7--FILE-- 8<?php 9/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) 10 * Description: Get the full unfiltered header for a message 11 * Source code: ext/imap/php_imap.c 12 */ 13 14/* 15 * Test if FT_UID is set by passing the following as $options argument to imap_fetchheader(): 16 * 1. values that equate to 1 17 * 2. Minimum and maximum PHP values 18 */ 19 20echo "*** Testing imap_fetchheader() : usage variations ***\n"; 21 22require_once(dirname(__FILE__).'/imap_include.inc'); 23 24// Initialise required variables 25$stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message 26$msg_no = 1; 27$msg_uid = imap_uid($stream_id, $msg_no); 28 29$options = array ('1', true, 30 1.000000000000001, 0.00001e5, 31 PHP_INT_MAX, -PHP_INT_MAX); 32 33// iterate over each element of $options array to test whether FT_UID is set 34$iterator = 1; 35imap_check($stream_id); 36foreach($options as $option) { 37 echo "\n-- Iteration $iterator --\n"; 38 if(is_string(imap_fetchheader($stream_id, $msg_uid, $option))) { 39 echo "FT_UID valid\n"; 40 } else { 41 echo "FT_UID not valid\n"; 42 } 43 $iterator++; 44} 45?> 46===DONE=== 47--CLEAN-- 48<?php 49require_once(dirname(__FILE__).'/clean.inc'); 50?> 51--EXPECTF-- 52*** Testing imap_fetchheader() : usage variations *** 53Create a temporary mailbox and add 1 msgs 54.. mailbox '{%s}%s' created 55 56-- Iteration 1 -- 57FT_UID valid 58 59-- Iteration 2 -- 60FT_UID valid 61 62-- Iteration 3 -- 63FT_UID valid 64 65-- Iteration 4 -- 66FT_UID valid 67 68-- Iteration 5 -- 69 70Warning: imap_fetchheader(): invalid value for the options parameter in %s on line %d 71FT_UID not valid 72 73-- Iteration 6 -- 74 75Warning: imap_fetchheader(): invalid value for the options parameter in %s on line %d 76FT_UID not valid 77===DONE=== 78