2 Test imap_fetchheader() function : usage variations - diff data types for $msg_no arg
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 data types as $msg_no argument to test behaviour of imap_fetchheader()
18 echo "*** Testing imap_fetchheader() : usage variations ***\n";
19 require_once(dirname(__FILE__).'/imap_include.inc');
21 // Initialise function arguments not being substituted
22 $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg
24 //get an unset variable
31 public function __toString() {
32 return "Class A object";
41 $index_array = array (1, 2, 3);
42 $assoc_array = array ('one' => 1, 'two' => 2);
44 // get a resource variable
45 $fp = fopen(__FILE__, "r");
47 // unexpected values to be passed to $msg_no argument
86 array('foo', $index_array, $assoc_array),
93 /*26*/ @$undefined_var,
102 // loop through each element of $inputs to check the behavior of imap_fetchheader()
104 foreach($inputs as $input) {
105 echo "\n-- Iteration $iterator --\n";
106 var_dump( imap_fetchheader($stream_id, $input) );
115 require_once(dirname(__FILE__).'/clean.inc');
119 *** Testing imap_fetchheader() : usage variations ***
120 Create a temporary mailbox and add 1 msgs
121 .. mailbox '{%s}%s' created
125 Warning: imap_fetchheader(): Bad message number in %s on line %d
129 %unicode|string%(%d) "From: foo@anywhere.com
133 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
139 Warning: imap_fetchheader(): Bad message number in %s on line %d
144 Warning: imap_fetchheader(): Bad message number in %s on line %d
149 Warning: imap_fetchheader(): Bad message number in %s on line %d
154 Warning: imap_fetchheader(): Bad message number in %s on line %d
159 Warning: imap_fetchheader(): Bad message number in %s on line %d
164 Warning: imap_fetchheader(): Bad message number in %s on line %d
169 Warning: imap_fetchheader(): Bad message number in %s on line %d
174 Warning: imap_fetchheader(): Bad message number in %s on line %d
179 Warning: imap_fetchheader(): Bad message number in %s on line %d
183 %unicode|string%(%d) "From: foo@anywhere.com
187 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
193 Warning: imap_fetchheader(): Bad message number in %s on line %d
197 %unicode|string%(%d) "From: foo@anywhere.com
201 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
207 Warning: imap_fetchheader(): Bad message number in %s on line %d
212 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
217 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
222 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
227 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
232 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
237 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
242 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
247 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
252 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
257 Warning: imap_fetchheader() expects parameter 2 to be long, object given in %s on line %d
262 Warning: imap_fetchheader(): Bad message number in %s on line %d
267 Warning: imap_fetchheader(): Bad message number in %s on line %d
272 Warning: imap_fetchheader() expects parameter 2 to be long, resource given in %s on line %d