2 Test imap_fetchbody() function : usage variations - FT_UID option
5 require_once(dirname(__FILE__).'/skipif.inc');
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
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
19 echo "*** Testing imap_fetchbody() : usage variations ***\n";
21 require_once(dirname(__FILE__).'/imap_include.inc');
23 // Initialise required variables
24 $stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message
26 $msg_uid = imap_uid($stream_id, $msg_no);
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);
34 // iterate over each element of $options array to test whether FT_UID is set
36 imap_check($stream_id);
37 foreach($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";
42 echo "FT_UID not valid\n";
51 require_once(dirname(__FILE__).'/clean.inc');
54 *** Testing imap_fetchbody() : usage variations ***
55 Create a temporary mailbox and add 1 msgs
56 .. mailbox '{%s}%s' created
72 Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d
77 Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d