diff options
author | Zoe Slattery <zoe@php.net> | 2009-01-23 15:31:35 +0000 |
---|---|---|
committer | Zoe Slattery <zoe@php.net> | 2009-01-23 15:31:35 +0000 |
commit | 3bda2b968987252ef0992030f13f1965c4de0070 (patch) | |
tree | be05c9d04f9ecd9f8889eb64e68ecaf17f980208 | |
parent | 294364dfee282b1a409fd2cd93973e661cf89a8d (diff) | |
download | php-git-3bda2b968987252ef0992030f13f1965c4de0070.tar.gz |
IMPA fetchheader tests
-rw-r--r-- | ext/imap/tests/imap_fetchheader_basic.phpt | 83 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchheader_error.phpt | 49 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchheader_variation1.phpt | 245 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchheader_variation2.phpt | 274 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchheader_variation3.phpt | 77 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchheader_variation4.phpt | 45 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchheader_variation5.phpt | 83 |
7 files changed, 856 insertions, 0 deletions
diff --git a/ext/imap/tests/imap_fetchheader_basic.phpt b/ext/imap/tests/imap_fetchheader_basic.phpt new file mode 100644 index 0000000000..5502c55fc4 --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_basic.phpt @@ -0,0 +1,83 @@ +--TEST-- +Test imap_fetchheader() function : basic function +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +echo "*** Testing imap_fetchheader() : basic functionality ***\n"; +require_once(dirname(__FILE__).'/imap_include.inc'); + +// Initialise all required variables +$stream_id = setup_test_mailbox('', 1, $mailbox, 'multiPart'); // setup temp mailbox with 1 msg +$msg_no = 1; +$options = array('FT_UID' => FT_UID, 'FT_INTERNAL' => FT_INTERNAL, + 'FT_PREFETCHTEXT' => FT_PREFETCHTEXT); + +// Calling imap_fetchheader() with all possible arguments +echo "\n-- All possible arguments --\n"; +foreach ($options as $key => $option) { + echo "-- Option is $key --\n"; + if ($key == 'FT_UID') { + $msg_uid = imap_uid($stream_id, $msg_no); + var_dump(imap_fetchheader($stream_id, $msg_uid, $option)); + } else { + var_dump(imap_fetchheader($stream_id, $msg_no, $option)); + } +} + +// Calling imap_fetchheader() with mandatory arguments +echo "\n-- Mandatory arguments --\n"; +var_dump( imap_fetchheader($stream_id, $msg_no) ); +?> +===DONE=== +--CLEAN-- +<?php +require_once(dirname(__FILE__).'/clean.inc'); +?> +--EXPECTF-- +*** Testing imap_fetchheader() : basic functionality *** +Create a temporary mailbox and add 1 msgs +.. mailbox '%s.phpttest' created + +-- All possible arguments -- +-- Option is FT_UID -- +string(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: %s +MIME-Version: 1.0 +Content-Type: %s; %s + +" +-- Option is FT_INTERNAL -- +string(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: %s +MIME-Version: 1.0 +Content-Type: %s; %s + +" +-- Option is FT_PREFETCHTEXT -- +string(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: %s +MIME-Version: 1.0 +Content-Type: %s; %s + +" + +-- Mandatory arguments -- +string(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: %s +MIME-Version: 1.0 +Content-Type: %s; %s + +" +===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_error.phpt b/ext/imap/tests/imap_fetchheader_error.phpt new file mode 100644 index 0000000000..e2f5b1260b --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test imap_fetchheader() function : error conditions - incorrect number of args +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +/* + * Pass an incorrect number of arguments to imap_fetchheader() to test behaviour + */ + +echo "*** Testing imap_fetchheader() : error conditions ***\n"; +require_once(dirname(__FILE__).'/imap_include.inc'); + +//Test imap_fetchheader with one more than the expected number of arguments +echo "\n-- Testing imap_fetchheader() function with more than expected no. of arguments --\n"; + +$stream_id = imap_open($server, $username, $password); +$msg_no = 10; +$options = 10; +$extra_arg = 10; +var_dump( imap_fetchheader($stream_id, $msg_no, $options, $extra_arg) ); + +// Testing imap_fetchheader with one less than the expected number of arguments +echo "\n-- Testing imap_fetchheader() function with less than expected no. of arguments --\n"; +var_dump( imap_fetchheader($stream_id) ); + +imap_close($stream_id); +?> +===DONE=== +--EXPECTF-- +*** Testing imap_fetchheader() : error conditions *** + +-- Testing imap_fetchheader() function with more than expected no. of arguments -- + +Warning: imap_fetchheader() expects at most 3 parameters, 4 given in %s on line %d +NULL + +-- Testing imap_fetchheader() function with less than expected no. of arguments -- + +Warning: imap_fetchheader() expects at least 2 parameters, 1 given in %s on line %d +NULL +===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_variation1.phpt b/ext/imap/tests/imap_fetchheader_variation1.phpt new file mode 100644 index 0000000000..0c0e9e1f26 --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test imap_fetchheader() function : usage variations - diff data types as $stream_id arg +--SKIPIF-- +<?php +extension_loaded('imap') or die('skip imap extension not available in this build'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +/* + * Pass different data types as $stream_id argument to test behaviour of imap_fetchheader() + */ + +echo "*** Testing imap_fetchheader() : usage variations ***\n"; + +// Initialise function arguments not being substituted +$msg_no = 1; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// get different types of array +$index_array = array (1, 2, 3); +$assoc_array = array ('one' => 1, 'two' => 2); + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// unexpected values to be passed to $stream_id argument +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + + // string data +/*18*/ "string", + 'string', + $heredoc, + + // array data +/*21*/ array(), + $index_array, + $assoc_array, + array('foo', $index_array, $assoc_array), + + + // object data +/*25*/ new classA(), + + // undefined data +/*26*/ @$undefined_var, + + // unset data +/*27*/ @$unset_var, +); + +// loop through each element of $inputs to check the behavior of imap_fetchheader() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( imap_fetchheader($input, $msg_no) ); + $iterator++; +}; +?> +===DONE=== +--EXPECTF-- +*** Testing imap_fetchheader() : usage variations *** + +-- Iteration 1 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, object given in %s on line %d +NULL + +-- Iteration 26 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 27 -- + +Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d +NULL +===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_variation2.phpt b/ext/imap/tests/imap_fetchheader_variation2.phpt new file mode 100644 index 0000000000..d2269adf89 --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_variation2.phpt @@ -0,0 +1,274 @@ +--TEST-- +Test imap_fetchheader() function : usage variations - diff data types for $msg_no arg +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +/* + * Pass different data types as $msg_no argument to test behaviour of imap_fetchheader() + */ + +echo "*** Testing imap_fetchheader() : usage variations ***\n"; +require_once(dirname(__FILE__).'/imap_include.inc'); + +// Initialise function arguments not being substituted +$stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +$index_array = array (1, 2, 3); +$assoc_array = array ('one' => 1, 'two' => 2); + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// unexpected values to be passed to $msg_no argument +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + + // string data +/*18*/ "string", + 'string', + $heredoc, + + // array data +/*21*/ array(), + $index_array, + $assoc_array, + array('foo', $index_array, $assoc_array), + + + // object data +/*25*/ new classA(), + + // undefined data +/*26*/ @$undefined_var, + + // unset data +/*27*/ @$unset_var, + + // resource variable +/*28*/ $fp +); + +// loop through each element of $inputs to check the behavior of imap_fetchheader() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( imap_fetchheader($stream_id, $input) ); + $iterator++; +}; + +fclose($fp); +?> +===DONE=== +--CLEAN-- +<?php +require_once(dirname(__FILE__).'/clean.inc'); +?> +===DONE=== +--EXPECTF-- +*** Testing imap_fetchheader() : usage variations *** +Create a temporary mailbox and add 1 msgs +.. mailbox '{localhost/norsh}INBOX.phpttest' created + +-- Iteration 1 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 2 -- +%unicode|string%(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: webmaster@something.com +MIME-Version: 1.0 +Content-Type: MULTIPART/mixed; BOUNDARY="%s" + +" + +-- Iteration 3 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 12 -- +%unicode|string%(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: webmaster@something.com +MIME-Version: 1.0 +Content-Type: MULTIPART/mixed; BOUNDARY="%s" + +" + +-- Iteration 13 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 14 -- +%unicode|string%(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: webmaster@something.com +MIME-Version: 1.0 +Content-Type: MULTIPART/mixed; BOUNDARY="%s" + +" + +-- Iteration 15 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 26 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 27 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + +-- Iteration 28 -- + +Warning: imap_fetchheader() expects parameter 2 to be long, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_variation3.phpt b/ext/imap/tests/imap_fetchheader_variation3.phpt new file mode 100644 index 0000000000..e21c1a966c --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_variation3.phpt @@ -0,0 +1,77 @@ +--TEST-- +Test imap_fetchheader() function : usage variations - FT_UID option +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +/* + * Test if FT_UID is set by passing the following as $options argument to imap_fetchheader(): + * 1. values that equate to 1 + * 2. Minimum and maximum PHP values + */ + +echo "*** Testing imap_fetchheader() : usage variations ***\n"; + +require_once(dirname(__FILE__).'/imap_include.inc'); + +// Initialise required variables +$stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message +$msg_no = 1; +$msg_uid = imap_uid($stream_id, $msg_no); + +$options = array ('1', true, + 1.000000000000001, 0.00001e5, + PHP_INT_MAX, -PHP_INT_MAX); + +// iterate over each element of $options array to test whether FT_UID is set +$iterator = 1; +imap_check($stream_id); +foreach($options as $option) { + echo "\n-- Iteration $iterator --\n"; + if(is_string(imap_fetchheader($stream_id, $msg_uid, $option))) { + echo "FT_UID valid\n"; + } else { + echo "FT_UID not valid\n"; + } + $iterator++; +} +?> +===DONE=== +--CLEAN-- +<?php +require_once(dirname(__FILE__).'/clean.inc'); +?> +--EXPECTF-- +*** Testing imap_fetchheader() : usage variations *** +Create a temporary mailbox and add 1 msgs +.. mailbox '{localhost/norsh}INBOX.phpttest' created + +-- Iteration 1 -- +FT_UID valid + +-- Iteration 2 -- +FT_UID valid + +-- Iteration 3 -- +FT_UID valid + +-- Iteration 4 -- +FT_UID valid + +-- Iteration 5 -- + +Warning: imap_fetchheader(): invalid value for the options parameter in %s on line %d +FT_UID not valid + +-- Iteration 6 -- + +Warning: imap_fetchheader(): invalid value for the options parameter in %s on line %d +FT_UID not valid +===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_variation4.phpt b/ext/imap/tests/imap_fetchheader_variation4.phpt new file mode 100644 index 0000000000..b4b19e3d37 --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_variation4.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test imap_fetchheader() function : usage variations - diff resource types as $stream_id +--SKIPIF-- +<?php +extension_loaded('imap') or die('skip imap extension not available in this build'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +/* + * Pass different types of resources to imap_fetchheader() to test behaviour + */ + +echo "*** Testing imap_fetchheader() : usage variations ***\n"; + +echo "\n-- File Resource opened with fopen() --\n"; +var_dump($file_pointer = fopen(__FILE__, 'r+')); +var_dump(imap_fetchheader($file_pointer, 1)); +fclose($file_pointer); + +echo "\n-- Directory Resource opened with opendir() --\n"; +var_dump($dir_handle = opendir(dirname(__FILE__))); +var_dump(imap_fetchheader($dir_handle, 1)); +closedir($dir_handle); +?> +===DONE=== +--EXPECTF-- +*** Testing imap_fetchheader() : usage variations *** + +-- File Resource opened with fopen() -- +resource(%d) of type (stream) + +Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d +bool(false) + +-- Directory Resource opened with opendir() -- +resource(%d) of type (stream) + +Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d +bool(false) +===DONE===
\ No newline at end of file diff --git a/ext/imap/tests/imap_fetchheader_variation5.phpt b/ext/imap/tests/imap_fetchheader_variation5.phpt new file mode 100644 index 0000000000..6f5b426d3a --- /dev/null +++ b/ext/imap/tests/imap_fetchheader_variation5.phpt @@ -0,0 +1,83 @@ +--TEST-- +Test imap_fetchheader() function : usage variations - $msg_no argument +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) + * Description: Get the full unfiltered header for a message + * Source code: ext/imap/php_imap.c + */ + +/* + * Pass different integers and strings as $msg_no argument + * to test behaviour of imap_fetchheader() + */ + +echo "*** Testing imap_fetchheader() : usage variations ***\n"; + +require_once(dirname(__FILE__).'/imap_include.inc'); + +$stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs + +$sequences = array (0, 4, // out of range + '1,3', '1:3', // message sequences instead of numbers + ); + +foreach($sequences as $msg_no) { + echo "\n-- \$msg_no is $msg_no --\n"; + var_dump($overview = imap_fetchheader($stream_id, $msg_no)); + if (!$overview) { + echo imap_last_error() . "\n"; + } +} + +// clear error stack +imap_errors(); +?> +===DONE=== +--CLEAN-- +<?php +require_once(dirname(__FILE__).'/clean.inc'); +?> +--EXPECTF-- +*** Testing imap_fetchheader() : usage variations *** +Create a temporary mailbox and add 3 msgs +.. mailbox '{localhost/norsh}INBOX.phpttest' created + +-- $msg_no is 0 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + + +-- $msg_no is 4 -- + +Warning: imap_fetchheader(): Bad message number in %s on line %d +bool(false) + + +-- $msg_no is 1,3 -- + +Notice: A non well formed numeric value encountered in %s on line %d +%unicode|string%(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: webmaster@something.com +MIME-Version: 1.0 +Content-Type: MULTIPART/mixed; BOUNDARY="%s" + +" + +-- $msg_no is 1:3 -- + +Notice: A non well formed numeric value encountered in %s on line %d +%unicode|string%(%d) "From: foo@anywhere.com +Subject: Test msg 1 +To: webmaster@something.com +MIME-Version: 1.0 +Content-Type: MULTIPART/mixed; BOUNDARY="%s" + +" +===DONE=== |