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