1--TEST-- 2Test imap_fetchbody() 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_fetchbody(resource $stream_id, int $msg_no, string $section [, int $options]) 10 * Description: Get a specific body section 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_fetchbody(): 16 * 1. values that equate to 1 17 * 2. Minimum and maximum PHP values 18 */ 19echo "*** Testing imap_fetchbody() : usage variations ***\n"; 20 21require_once(dirname(__FILE__).'/imap_include.inc'); 22 23// Initialise required variables 24$stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message 25$msg_no = 1; 26$msg_uid = imap_uid($stream_id, $msg_no); 27$section = 1; 28 29//Note: the first four values are valid as they will all be cast to 1L. 30$options = array ('1', true, 31 1.000000000000001, 0.00001e5, 32 PHP_INT_MAX, -PHP_INT_MAX); 33 34// iterate over each element of $options array to test whether FT_UID is set 35$iterator = 1; 36imap_check($stream_id); 37foreach($options as $option) { 38 echo "\n-- Iteration $iterator --\n"; 39 if(is_string(imap_fetchbody($stream_id, $msg_uid, $section, $option))) { 40 echo "FT_UID valid\n"; 41 } else { 42 echo "FT_UID not valid\n"; 43 } 44 $iterator++; 45} 46 47?> 48===DONE=== 49--CLEAN-- 50<?php 51require_once(dirname(__FILE__).'/clean.inc'); 52?> 53--EXPECTF-- 54*** Testing imap_fetchbody() : usage variations *** 55Create a temporary mailbox and add 1 msgs 56.. mailbox '{%s}%s' created 57 58-- Iteration 1 -- 59FT_UID valid 60 61-- Iteration 2 -- 62FT_UID valid 63 64-- Iteration 3 -- 65FT_UID valid 66 67-- Iteration 4 -- 68FT_UID valid 69 70-- Iteration 5 -- 71 72Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d 73FT_UID not valid 74 75-- Iteration 6 -- 76 77Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d 78FT_UID not valid 79===DONE=== 80