2 Test imap_fetchheader() function : usage variations - $msg_no argument
5 require_once(dirname(__FILE__).'/skipif.inc');
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
15 * Pass different integers and strings as $msg_no argument
16 * to test behaviour of imap_fetchheader()
19 echo "*** Testing imap_fetchheader() : usage variations ***\n";
21 require_once(dirname(__FILE__).'/imap_include.inc');
23 $stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs
25 $sequences = array (0, 4, // out of range
26 '1,3', '1:3', // message sequences instead of numbers
29 foreach($sequences as $msg_no) {
30 echo "\n-- \$msg_no is $msg_no --\n";
31 var_dump($overview = imap_fetchheader($stream_id, $msg_no));
33 echo imap_last_error() . "\n";
43 require_once(dirname(__FILE__).'/clean.inc');
46 *** Testing imap_fetchheader() : usage variations ***
47 Create a temporary mailbox and add 3 msgs
48 .. mailbox '{%s}%s' created
52 Warning: imap_fetchheader(): Bad message number in %s on line %d
58 Warning: imap_fetchheader(): Bad message number in %s on line %d
64 Notice: A non well formed numeric value encountered in %s on line %d
65 %unicode|string%(%d) "From: foo@anywhere.com
69 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
75 Notice: A non well formed numeric value encountered in %s on line %d
76 %unicode|string%(%d) "From: foo@anywhere.com
80 Content-Type: MULTIPART/mixed; BOUNDARY="%s"