2 Test imap_fetchbody() function : usage variations - $msg_no arg
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 * Pass different integers, strings, msg sequences and msg UIDs as $msg_no argument
16 * to test behaviour of imap_fetchbody()
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('', 3); // set up temp mailbox with simple msgs
27 $sequences = array (0, 4, // out of range
28 '1,3', '1:3', // message sequences instead of numbers
31 foreach($sequences as $msg_no) {
32 echo "\n-- \$msg_no is $msg_no --\n";
33 var_dump($overview = imap_fetchbody($stream_id, $msg_no, $section));
35 echo imap_last_error() . "\n";
42 require_once(dirname(__FILE__).'/clean.inc');
45 *** Testing imap_fetchbody() : usage variations ***
46 Create a temporary mailbox and add 3 msgs
47 .. mailbox '{%s}%s' created
51 Warning: imap_fetchbody(): Bad message number in %s on line %d
57 Warning: imap_fetchbody(): Bad message number in %s on line %d
63 Notice: A non well formed numeric value encountered in %s on line %d
64 %unicode|string%(%d) "1: this is a test message, please ignore%a"
68 Notice: A non well formed numeric value encountered in %s on line %d
69 %unicode|string%(%d) "1: this is a test message, please ignore%a"