1--TEST-- 2Test mail() function : error conditions 3--FILE-- 4<?php 5/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]]) 6 * Description: Send an email message 7 * Source code: ext/standard/mail.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing mail() : error conditions ***\n"; 12 13 14//Test mail with one more than the expected number of arguments 15echo "\n-- Testing mail() function with more than expected no. of arguments --\n"; 16$to = 'string_val'; 17$subject = 'string_val'; 18$message = 'string_val'; 19$additional_headers = 'string_val'; 20$additional_parameters = 'string_val'; 21$extra_arg = 10; 22var_dump( mail($to, $subject, $message, $additional_headers, $additional_parameters, $extra_arg) ); 23 24// Testing mail with one less than the expected number of arguments 25echo "\n-- Testing mail() function with less than expected no. of arguments --\n"; 26$to = 'string_val'; 27$subject = 'string_val'; 28var_dump( mail($to, $subject) ); 29 30?> 31===DONE=== 32--EXPECTF-- 33*** Testing mail() : error conditions *** 34 35-- Testing mail() function with more than expected no. of arguments -- 36 37Warning: mail() expects at most 5 parameters, 6 given in %s on line %d 38NULL 39 40-- Testing mail() function with less than expected no. of arguments -- 41 42Warning: mail() expects at least 3 parameters, 2 given in %s on line %d 43NULL 44===DONE=== 45