1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 13:31:27 +02:00
Files
archived-php-src/ext/imap/tests/bug80223.phpt
George Peter Banyard 158d308197 Throw Value/TypeError for invalid $bodies in imap_mail_compose()
Small drive by refactoring to use HashTables

Closes GH-6371
2020-10-23 20:47:35 +01:00

29 lines
736 B
PHP

--TEST--
Bug #80223 (imap_mail_compose() leaks envelope on malformed bodies)
--SKIPIF--
<?php
if (!extension_loaded('imap')) die('skip imap extension not available');
?>
--FILE--
<?php
try {
imap_mail_compose([], []);
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
imap_mail_compose([], [1]);
} catch (\TypeError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
imap_mail_compose([], [[]]);
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
?>
--EXPECT--
imap_mail_compose(): Argument #2 ($bodies) cannot be empty
imap_mail_compose(): Argument #2 ($bodies) individual body must be of type array, int given
imap_mail_compose(): Argument #2 ($bodies) individual body cannot be empty