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