1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Files
archived-php-src/ext/standard/tests/mail/mail_basic5.phpt
Jesse Hathaway 6a7561203d mail: add logging on errors
Prior to this commit the exit code of the sendmail command, called by
the mail function was lost, since the mail function only returns true or
false. Add additional logging to the mail function to capture the exit
code when the sendmail command fails.
2025-06-24 11:55:45 +02:00

29 lines
605 B
PHP

--TEST--
Test mail() function : basic functionality
--INI--
sendmail_path="exit 1"
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) == "WIN")
die("skip Won't run on Windows");
?>
--FILE--
<?php
echo "*** Testing mail() : basic functionality ***\n";
// Initialise all required variables
$to = 'user@example.com';
$subject = 'Test Subject';
$message = 'A Message';
echo "-- failure --\n";
var_dump( mail($to, $subject, $message) );
?>
--EXPECTF--
*** Testing mail() : basic functionality ***
-- failure --
Warning: mail(): Sendmail exited with non-zero exit code 1 in %smail_basic5.php on line %d
bool(false)