Commit 43f7a9752d6 for php.net
commit 43f7a9752d66594da195baef1fbecc310308ccc6
Merge: 5c9a67b8a9c e0d6b21c595
Author: Shivam Mathur <shivam_jpr@hotmail.com>
Date: Wed Aug 5 12:31:24 2026 +0530
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
Fix hMailServer URL in Windows CI (#23055)
diff --cc .github/scripts/windows/test_task.bat
index 7c526be95c3,25d6c0eec04..6c49ebe4041
--- a/.github/scripts/windows/test_task.bat
+++ b/.github/scripts/windows/test_task.bat
@@@ -117,10 -115,11 +117,11 @@@ set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\R
if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS
rem prepare for mail
- curl -sLo hMailServer.exe https://www.hmailserver.com/download_file/?downloadid=271
- hMailServer.exe /verysilent
+ curl -sLo hMailServer.zip https://downloads.php.net/~windows/php-sdk/deps/vs18/x64/hmailserver-5.7.0-vs18-x64.zip
+ unzip -q hMailServer.zip -d hMailServer
+ hMailServer\bin\hMailServer.exe /verysilent
cd %APPVEYOR_BUILD_FOLDER%
-%PHP_BUILD_DIR%\php.exe -dextension_dir=%PHP_BUILD_DIR% -dextension=com_dotnet appveyor\setup_hmailserver.php
+%PHP_BUILD_DIR%\php.exe -dextension_dir=%PHP_BUILD_DIR% -dextension=com_dotnet .github\setup_hmailserver.php
mkdir %PHP_BUILD_DIR%\test_file_cache
rem generate php.ini
diff --cc ext/standard/tests/mail/bug80751.phpt
index b6dc29e42f1,97cb0575f82..802bd542482
--- a/ext/standard/tests/mail/bug80751.phpt
+++ b/ext/standard/tests/mail/bug80751.phpt
@@@ -10,50 -15,66 +10,50 @@@ SMTP=localhos
smtp_port=25
--FILE--
<?php
-require_once __DIR__ . '/mail_include.inc';
-function find_and_delete_message($username, $subject) {
- global $default_mailbox, $password, $users, $domain;
+require_once __DIR__.'/mail_util.inc';
+$users = MailBox::USERS;
- $imap_stream = imap_open($default_mailbox, $username, $password);
- if ($imap_stream === false) {
- die("Cannot connect to IMAP server $server: " . imap_last_error() . "\n");
- }
+$to = $users[0];
+$toLine = "\"<bug80751_to_name@example.com>\" <{$to}>";
- $found = false;
- $repeat_count = 20; // we will repeat a max of 20 times
- while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
-
- $num_messages = imap_check($imap_stream)->Nmsgs;
- for ($i = $num_messages; $i > 0; $i--) {
- $info = imap_headerinfo($imap_stream, $i);
- if ($info->subject === $subject) {
- $header = imap_fetchheader($imap_stream, $i);
- echo "Return-Path header found: ";
- var_dump(strpos($header, 'Return-Path: <joe@example.com>') !== false);
- echo "To header found: ";
- var_dump(strpos($header, "To: \"<bob@example.com>\" <{$users[1]}@$domain>") !== false);
- echo "From header found: ";
- var_dump(strpos($header, 'From: "<bob@example.com>" <joe@example.com>') !== false);
- echo "Cc header found: ";
- var_dump(strpos($header, "Cc: \"Lastname, Firstname\\\\\" <{$users[2]}@$domain>") !== false);
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
- $repeat_count--;
- }
+$from = 'bug80751_from@example.com';
+$fromLine = "\"<bug80751_from_name@example.com>\" <{$from}>";
- imap_close($imap_stream, CL_EXPUNGE);
- return $found;
-}
+$cc = $users[1];
+$ccLine = "\"Lastname, Firstname\\\\\" <{$cc}>";
-$to = "\"<bob@example.com>\" <{$users[1]}@$domain>";
-$subject = bin2hex(random_bytes(16));
+$bcc = $users[2];
+$subject = 'mail_bug80751';
$message = 'hello';
-$headers = "From: \"<bob@example.com>\" <joe@example.com>\r\n"
- . "Cc: \"Lastname, Firstname\\\\\" <{$users[2]}@$domain>\r\n"
- . "Bcc: \"Firstname \\\"Ni,ck\\\" Lastname\" <{$users[3]}@$domain>\r\n";
-$res = mail($to, $subject, $message, $headers);
+$headers = "From: {$fromLine}\r\n"
+ . "Cc: {$ccLine}\r\n"
+ . "Bcc: \"Firstname \\\"Ni,ck\\\" Lastname\" <{$bcc}>\r\n";
+
+$res = mail($toLine, $subject, $message, $headers);
+
if ($res !== true) {
- die("TEST FAILED : Unable to send test email\n");
-} else {
- echo "Message sent OK\n";
+ die("Unable to send the email.\n");
}
-foreach ([$users[1], $users[2], $users[3]] as $user) {
- if (!find_and_delete_message("$user@$domain", $subject)) {
- echo "TEST FAILED: email not delivered\n";
- } else {
- echo "TEST PASSED: Message sent and deleted OK\n";
+echo "Email sent.\n";
+
+foreach (['to' => $to, 'cc' => $cc, 'bcc' => $bcc] as $recipient => $mailAddress) {
+ $mailBox = MailBox::login($mailAddress);
+ $mail = $mailBox->getMailsBySubject($subject);
+ $mailBox->logout();
+
+ if ($mail->isAsExpected($fromLine, $toLine, $subject, $message)) {
+ echo "Found the email. {$recipient} received.\n";
+ }
+
- if ($mail->getHeader('Return-Path') === $from) {
++ if ($mail->getHeader('Return-Path') === "<{$from}>") {
+ echo "Return-Path is as expected.\n";
+ }
+
+ if ($mail->getHeader('Cc') === $ccLine) {
+ echo "Cc header is as expected.\n\n";
}
}
?>