2 Test imap_fetch_overview() function : usage variations - diff data types as $msg_no arg
5 require_once(dirname(__FILE__).'/skipif.inc');
9 /* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
10 * Description: Read an overview of the information in the headers
11 * of the given message sequence
12 * Source code: ext/imap/php_imap.c
16 * Pass different data types as $msg_no argument to imap_fetch_overview() to test behaviour
19 echo "*** Testing imap_fetch_overview() : usage variations ***\n";
20 require_once(dirname(__FILE__).'/imap_include.inc');
22 // Initialise function arguments not being substituted
23 $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg
25 //get an unset variable
32 public function __toString() {
33 return "Class A object";
42 // get a resource variable
43 $fp = fopen(__FILE__, "r");
45 // unexpected values to be passed to <<<ARGUMENT HERE>>> argument
85 /*23*/ @$undefined_var,
94 // loop through each element of $inputs to check the behavior of imap_fetch_overview()
96 foreach($inputs as $input) {
97 echo "\n-- Testing with second argument value: ";
99 $overview = imap_fetch_overview($stream_id, $input);
101 echo imap_last_error() . "\n";
103 displayOverviewFields($overview[0]);
110 // clear the error stack
116 require_once(dirname(__FILE__).'/clean.inc');
119 *** Testing imap_fetch_overview() : usage variations ***
120 Create a temporary mailbox and add 1 msgs
121 .. mailbox '{%s}%s' created
123 -- Testing with second argument value: int(0)
124 Sequence out of range
126 -- Testing with second argument value: int(1)
138 -- Testing with second argument value: int(12345)
139 Sequence out of range
141 -- Testing with second argument value: int(-2345)
142 Syntax error in sequence
144 -- Testing with second argument value: float(10.5)
145 Sequence out of range
147 -- Testing with second argument value: float(-10.5)
148 Syntax error in sequence
150 -- Testing with second argument value: float(123456789000)
151 Sequence out of range
153 -- Testing with second argument value: float(1.23456789E-9)
154 Sequence syntax error
156 -- Testing with second argument value: float(0.5)
157 Sequence out of range
159 -- Testing with second argument value: NULL
160 Sequence out of range
162 -- Testing with second argument value: NULL
163 Sequence out of range
165 -- Testing with second argument value: bool(true)
177 -- Testing with second argument value: bool(false)
178 Sequence out of range
180 -- Testing with second argument value: bool(true)
192 -- Testing with second argument value: bool(false)
193 Sequence out of range
195 -- Testing with second argument value: %string|unicode%(0) ""
196 Sequence out of range
198 -- Testing with second argument value: %string|unicode%(0) ""
199 Sequence out of range
201 -- Testing with second argument value: array(0) {
204 Warning: imap_fetch_overview() expects parameter 2 to be %binary_string_optional%, array given in %s on line %d
205 Sequence out of range
207 -- Testing with second argument value: %string|unicode%(6) "string"
208 Syntax error in sequence
210 -- Testing with second argument value: %string|unicode%(6) "string"
211 Syntax error in sequence
213 -- Testing with second argument value: %string|unicode%(11) "hello world"
214 Syntax error in sequence
216 -- Testing with second argument value: object(classA)#1 (0) {
218 Syntax error in sequence
220 -- Testing with second argument value: NULL
221 Syntax error in sequence
223 -- Testing with second argument value: NULL
224 Syntax error in sequence
226 -- Testing with second argument value: resource(%d) of type (stream)
228 Warning: imap_fetch_overview() expects parameter 2 to be %binary_string_optional%, resource given in %s on line %d
229 Syntax error in sequence