1--TEST-- 2Test imap_fetchheader() function : error conditions - incorrect number of args 3--SKIPIF-- 4<?php 5require_once(dirname(__FILE__).'/skipif.inc'); 6?> 7--FILE-- 8<?php 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 12 */ 13 14/* 15 * Pass an incorrect number of arguments to imap_fetchheader() to test behaviour 16 */ 17 18echo "*** Testing imap_fetchheader() : error conditions ***\n"; 19require_once(dirname(__FILE__).'/imap_include.inc'); 20 21//Test imap_fetchheader with one more than the expected number of arguments 22echo "\n-- Testing imap_fetchheader() function with more than expected no. of arguments --\n"; 23 24$stream_id = imap_open($server, $username, $password); 25$msg_no = 10; 26$options = 10; 27$extra_arg = 10; 28var_dump( imap_fetchheader($stream_id, $msg_no, $options, $extra_arg) ); 29 30// Testing imap_fetchheader with one less than the expected number of arguments 31echo "\n-- Testing imap_fetchheader() function with less than expected no. of arguments --\n"; 32var_dump( imap_fetchheader($stream_id) ); 33 34imap_close($stream_id); 35?> 36===DONE=== 37--EXPECTF-- 38*** Testing imap_fetchheader() : error conditions *** 39 40-- Testing imap_fetchheader() function with more than expected no. of arguments -- 41 42Warning: imap_fetchheader() expects at most 3 parameters, 4 given in %s on line %d 43NULL 44 45-- Testing imap_fetchheader() function with less than expected no. of arguments -- 46 47Warning: imap_fetchheader() expects at least 2 parameters, 1 given in %s on line %d 48NULL 49===DONE=== 50