xref: /PHP-8.1/ext/mbstring/tests/gh7902.phpt (revision 03816fba)
1--TEST--
2GH-7902 (mb_send_mail may delimit headers with LF only)
3--SKIPIF--
4<?php
5if (!extension_loaded("mbstring")) die("skip mbstring extension not available");
6?>
7--INI--
8sendmail_path={MAIL:{PWD}/gh7902.eml}
9--FILE--
10<?php
11mb_internal_encoding("UTF-8");
12mb_language("uni");
13$to = "omittedvalidaddress@example.com";
14$subject = "test mail";
15$message = "body of testing php mail";
16$header["Mime-Version"] = "1.0";
17$header["Content-Type"] = "text/html; charset=UTF-8";
18$header["From"] = "omittedvalidaddress2@example.com";
19$header["X-Mailer"] = "PHP/" . phpversion();
20mb_send_mail($to, $subject, $message, $header);
21
22$stream = fopen(__DIR__ . "/gh7902.eml", "rb");
23$eml = stream_get_contents($stream);
24fclose($stream);
25var_dump(preg_match_all('/(?<!\r)\n/', $eml));
26?>
27--CLEAN--
28<?php
29@unlink(__DIR__ . "/gh7902.eml");
30?>
31--EXPECT--
32int(0)
33