xref: /PHP-8.1/ext/imap/tests/bug80223.phpt (revision 74859783)
1--TEST--
2Bug #80223 (imap_mail_compose() leaks envelope on malformed bodies)
3--EXTENSIONS--
4imap
5--FILE--
6<?php
7try {
8    imap_mail_compose([], []);
9} catch (\ValueError $e) {
10    echo $e->getMessage(), \PHP_EOL;
11}
12try {
13    imap_mail_compose([], [1]);
14} catch (\TypeError $e) {
15    echo $e->getMessage(), \PHP_EOL;
16}
17try {
18    imap_mail_compose([], [[]]);
19} catch (\ValueError $e) {
20    echo $e->getMessage(), \PHP_EOL;
21}
22?>
23--EXPECT--
24imap_mail_compose(): Argument #2 ($bodies) cannot be empty
25imap_mail_compose(): Argument #2 ($bodies) individual body must be of type array, int given
26imap_mail_compose(): Argument #2 ($bodies) individual body cannot be empty
27