summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-12-01 01:43:17 +0000
committerGeorge Peter Banyard <girgias@php.net>2020-12-03 17:43:08 +0000
commit426fe2f20c4e85c34f118ca891c99f70def1c8a8 (patch)
treea71543eef534de1422f840ccfcbdc2a9e76ff5bd
parente45cc31c41355bed684164856470979a280084fb (diff)
downloadphp-git-426fe2f20c4e85c34f118ca891c99f70def1c8a8.tar.gz
Standardize behaviour for int message number between functions
-rw-r--r--NEWS2
-rw-r--r--ext/imap/php_imap.c130
-rw-r--r--ext/imap/tests/imap_body_errors.phpt (renamed from ext/imap/tests/imap_body.phpt)20
-rw-r--r--ext/imap/tests/imap_fetchbody_errors.phpt49
-rw-r--r--ext/imap/tests/imap_fetchheader_errors.phpt47
-rw-r--r--ext/imap/tests/imap_fetchmime_errors.phpt49
-rw-r--r--ext/imap/tests/imap_fetchstructure_errors.phpt47
-rw-r--r--ext/imap/tests/imap_savebody_errors.phpt49
8 files changed, 300 insertions, 93 deletions
diff --git a/NEWS b/NEWS
index b1a0c50776..4a0509da4c 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ PHP NEWS
- IMAP
. Fixed bug #80438 (imap_msgno() incorrectly warns and return false on valid UIDs in PHP 8.0.0). (girgias)
+ . Fix a regression with valid UIDs in imap_savebody() (girgias)
+ . Make warnings for invalid message numbers/UIDs between functions consistent (girgias)
- Intl:
. Fixed bug #80425 (MessageFormatAdapter::getArgTypeList redefined). (Nikita)
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index b52c35c58b..bf04897c92 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -152,6 +152,28 @@ static int le_imap;
RETURN_FALSE; \
} \
+#define PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgindex, arg_pos) \
+ if (msgindex < 1) { \
+ zend_argument_value_error(arg_pos, "must be greater than 0"); \
+ RETURN_THROWS(); \
+ } \
+
+#define PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgindex, arg_pos, func_flags, uid_flag) \
+ if (func_flags & uid_flag) { \
+ /* This should be cached; if it causes an extra RTT to the IMAP server, */ \
+ /* then that's the price we pay for making sure we don't crash. */ \
+ unsigned int msg_no_from_uid = mail_msgno(imap_le_struct->imap_stream, msgindex); \
+ if (msg_no_from_uid == 0) { \
+ php_error_docref(NULL, E_WARNING, "UID does not exist"); \
+ RETURN_FALSE; \
+ } \
+ } else { \
+ if (((unsigned) msgindex) > imap_le_struct->imap_stream->nmsgs) { \
+ php_error_docref(NULL, E_WARNING, "Bad message number"); \
+ RETURN_FALSE; \
+ } \
+ } \
+
/* {{{ mail_close_it */
static void mail_close_it(zend_resource *rsrc)
{
@@ -1258,7 +1280,6 @@ PHP_FUNCTION(imap_body)
zval *streamind;
zend_long msgno, flags = 0;
pils *imap_le_struct;
- unsigned long msgindex;
char *body;
unsigned long body_len = 0;
@@ -1270,32 +1291,15 @@ PHP_FUNCTION(imap_body)
RETURN_THROWS();
}
- if (msgno < 1) {
- zend_argument_value_error(2, "must be greater than 0");
- RETURN_THROWS();
- }
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgno, 2);
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
zend_argument_value_error(3, "must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL");
RETURN_THROWS();
}
- if (flags && (flags & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making
- sure we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, msgno);
- if (msgindex == 0) {
- php_error_docref(NULL, E_WARNING, "UID does not exist");
- RETURN_FALSE;
- }
- } else {
- msgindex = (unsigned long) msgno;
- }
-
- PHP_IMAP_CHECK_MSGNO(msgindex, 2);
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgno, 2, flags, FT_UID);
- /* TODO Shouldn't this pass msgindex??? */
body = mail_fetchtext_full (imap_le_struct->imap_stream, msgno, &body_len, flags);
if (body_len == 0) {
RETVAL_EMPTY_STRING();
@@ -1305,6 +1309,7 @@ PHP_FUNCTION(imap_body)
}
/* }}} */
+/* TODO UID Tests */
/* {{{ Copy specified message to a mailbox */
PHP_FUNCTION(imap_mail_copy)
{
@@ -1334,6 +1339,7 @@ PHP_FUNCTION(imap_mail_copy)
}
/* }}} */
+/* TODO UID Tests */
/* {{{ Move specified message to a mailbox */
PHP_FUNCTION(imap_mail_move)
{
@@ -1605,13 +1611,15 @@ PHP_FUNCTION(imap_delete)
RETURN_THROWS();
}
+ // TODO Check sequence validity?
+
if (flags && ((flags & ~FT_UID) != 0)) {
zend_argument_value_error(3, "must be FT_UID or 0");
RETURN_THROWS();
}
mail_setflag_full(imap_le_struct->imap_stream, ZSTR_VAL(sequence), "\\DELETED", flags);
- RETVAL_TRUE;
+ RETURN_TRUE;
}
/* }}} */
@@ -1882,7 +1890,6 @@ PHP_FUNCTION(imap_fetchstructure)
zend_long msgno, flags = 0;
pils *imap_le_struct;
BODY *body;
- int msgindex;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &streamind, &msgno, &flags) == FAILURE) {
RETURN_THROWS();
@@ -1892,34 +1899,18 @@ PHP_FUNCTION(imap_fetchstructure)
RETURN_THROWS();
}
- if (msgno < 1) {
- zend_argument_value_error(2, "must be greater than 0");
- RETURN_THROWS();
- }
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgno, 2);
if (flags && ((flags & ~FT_UID) != 0)) {
zend_argument_value_error(3, "must be FT_UID or 0");
RETURN_THROWS();
}
- object_init(return_value);
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgno, 2, flags, FT_UID);
- if (flags & FT_UID) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making
- sure we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, msgno);
- if (msgindex == 0) {
- php_error_docref(NULL, E_WARNING, "UID does not exist");
- RETURN_FALSE;
- }
- } else {
- msgindex = msgno;
- }
- PHP_IMAP_CHECK_MSGNO(msgindex, 2);
+ object_init(return_value);
- /* TODO Shouldn't this pass msgindex??? */
- mail_fetchstructure_full(imap_le_struct->imap_stream, msgno, &body , (ZEND_NUM_ARGS() == 3 ? flags : NIL));
+ mail_fetchstructure_full(imap_le_struct->imap_stream, msgno, &body , flags);
if (!body) {
php_error_docref(NULL, E_WARNING, "No body information available");
@@ -1948,20 +1939,14 @@ PHP_FUNCTION(imap_fetchbody)
RETURN_THROWS();
}
- if (msgno < 1) {
- zend_argument_value_error(2, "must be greater than 0");
- RETURN_THROWS();
- }
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgno, 2);
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
zend_argument_value_error(4, "must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL");
RETURN_THROWS();
}
- if (!(flags & FT_UID)) {
- /* only perform the check if the msgno is a message number and not a UID */
- PHP_IMAP_CHECK_MSGNO(msgno, 2);
- }
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgno, 2, flags, FT_UID);
body = mail_fetchbody_full(imap_le_struct->imap_stream, msgno, ZSTR_VAL(sec), &len, flags);
@@ -1989,24 +1974,18 @@ PHP_FUNCTION(imap_fetchmime)
RETURN_THROWS();
}
- if (msgno < 1) {
- zend_argument_value_error(2, "must be greater than 0");
+ if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
RETURN_THROWS();
}
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgno, 2);
+
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
zend_argument_value_error(4, "must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL");
RETURN_THROWS();
}
- if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_THROWS();
- }
-
- if (!(flags & FT_UID)) {
- /* only perform the check if the msgno is a message number and not a UID */
- PHP_IMAP_CHECK_MSGNO(msgno, 2);
- }
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgno, 2, flags, FT_UID);
body = mail_fetch_mime(imap_le_struct->imap_stream, msgno, ZSTR_VAL(sec), &len, flags);
@@ -2037,18 +2016,14 @@ PHP_FUNCTION(imap_savebody)
RETURN_THROWS();
}
- // TODO Fix for UID and normal MSGNO
- //PHP_IMAP_CHECK_MSGNO(msgno, 3);
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgno, 3)
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
zend_argument_value_error(5, "must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL");
RETURN_THROWS();
}
- // TODO Drop this?
- if (!imap_le_struct) {
- RETURN_FALSE;
- }
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgno, 3, flags, FT_UID);
switch (Z_TYPE_P(out))
{
@@ -2772,9 +2747,8 @@ PHP_FUNCTION(imap_sort)
PHP_FUNCTION(imap_fetchheader)
{
zval *streamind;
- zend_long msgno, flags = 0L;
+ zend_long msgno, flags = 0;
pils *imap_le_struct;
- int msgindex;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &streamind, &msgno, &flags) == FAILURE) {
RETURN_THROWS();
@@ -2784,30 +2758,16 @@ PHP_FUNCTION(imap_fetchheader)
RETURN_THROWS();
}
- // TODO Check for msgno < 1 now or wait later for PHP_IMAP_CHECK_MSGNO check?
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_PRE_FLAG_CHECKS(msgno, 2);
if (flags && ((flags & ~(FT_UID|FT_INTERNAL|FT_PREFETCHTEXT)) != 0)) {
zend_argument_value_error(3, "must be a bitmask of FT_UID, FT_PREFETCHTEXT, and FT_INTERNAL");
RETURN_THROWS();
}
- if (flags & FT_UID) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making sure
- we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, msgno);
- if (msgindex == 0) {
- php_error_docref(NULL, E_WARNING, "UID does not exist");
- RETURN_FALSE;
- }
- } else {
- msgindex = msgno;
- }
-
- PHP_IMAP_CHECK_MSGNO(msgindex, 2);
+ PHP_IMAP_CHECK_MSGNO_MAYBE_UID_POST_FLAG_CHECKS(msgno, 2, flags, FT_UID);
- /* TODO Check shouldn't this pass msgindex???? */
- RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, msgno, NIL, NIL, (ZEND_NUM_ARGS() == 3 ? flags : NIL)));
+ RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, msgno, NIL, NIL, flags));
}
/* }}} */
diff --git a/ext/imap/tests/imap_body.phpt b/ext/imap/tests/imap_body_errors.phpt
index 59678ad539..8cc33b35c0 100644
--- a/ext/imap/tests/imap_body.phpt
+++ b/ext/imap/tests/imap_body_errors.phpt
@@ -1,5 +1,5 @@
--TEST--
-imap_body() ValueError
+imap_body() errors: ValueError and Warnings
--CREDITS--
Paul Sohier
#phptestfest utrecht
@@ -12,28 +12,29 @@ require_once(__DIR__.'/setup/skipif.inc');
require_once(__DIR__.'/setup/imap_include.inc');
-$imap_stream = setup_test_mailbox("imapbodyvalueerror", 0);
+$imap_mail_box = setup_test_mailbox("imapbodyerror", 0);
try {
- imap_body($imap_stream,-1);
+ imap_body($imap_mail_box, -1);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
- imap_body($imap_stream,1,-1);
+ imap_body($imap_mail_box, 1, -1);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
-//Access not existing
-var_dump(imap_body($imap_stream, 255, FT_UID));
+// Access not existing
+var_dump(imap_body($imap_mail_box, 255));
+var_dump(imap_body($imap_mail_box, 255, FT_UID));
-imap_close($imap_stream);
+imap_close($imap_mail_box);
?>
--CLEAN--
<?php
-$mailbox_suffix = 'imapbodyvalueerror';
+$mailbox_suffix = 'imapbodyerror';
require_once(__DIR__ . '/setup/clean.inc');
?>
--EXPECTF--
@@ -42,5 +43,8 @@ New mailbox created
imap_body(): Argument #2 ($message_num) must be greater than 0
imap_body(): Argument #3 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL
+Warning: imap_body(): Bad message number in %s on line %d
+bool(false)
+
Warning: imap_body(): UID does not exist in %s on line %d
bool(false)
diff --git a/ext/imap/tests/imap_fetchbody_errors.phpt b/ext/imap/tests/imap_fetchbody_errors.phpt
new file mode 100644
index 0000000000..e4eb13b3ae
--- /dev/null
+++ b/ext/imap/tests/imap_fetchbody_errors.phpt
@@ -0,0 +1,49 @@
+--TEST--
+imap_fetchbody() errors: ValueError and Warnings
+--SKIPIF--
+<?php
+require_once(__DIR__.'/setup/skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once(__DIR__.'/setup/imap_include.inc');
+
+$imap_mail_box = setup_test_mailbox("imapfetchbodyerrors", 0);
+
+$section = '';
+
+try {
+ imap_fetchbody($imap_mail_box, -1, $section);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ imap_fetchbody($imap_mail_box, 1, $section, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+// Access not existing
+var_dump(imap_fetchbody($imap_mail_box, 255, $section));
+var_dump(imap_fetchbody($imap_mail_box, 255, $section, FT_UID));
+
+imap_close($imap_mail_box);
+
+?>
+--CLEAN--
+<?php
+$mailbox_suffix = 'imapfetchbodyerrors';
+require_once(__DIR__ . '/setup/clean.inc');
+?>
+--EXPECTF--
+Create a temporary mailbox and add 0 msgs
+New mailbox created
+imap_fetchbody(): Argument #2 ($message_num) must be greater than 0
+imap_fetchbody(): Argument #4 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL
+
+Warning: imap_fetchbody(): Bad message number in %s on line %d
+bool(false)
+
+Warning: imap_fetchbody(): UID does not exist in %s on line %d
+bool(false)
diff --git a/ext/imap/tests/imap_fetchheader_errors.phpt b/ext/imap/tests/imap_fetchheader_errors.phpt
new file mode 100644
index 0000000000..72723a89c0
--- /dev/null
+++ b/ext/imap/tests/imap_fetchheader_errors.phpt
@@ -0,0 +1,47 @@
+--TEST--
+imap_fetchheader() errors: ValueError and Warnings
+--SKIPIF--
+<?php
+require_once(__DIR__.'/setup/skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once(__DIR__.'/setup/imap_include.inc');
+
+$imap_mail_box = setup_test_mailbox("imapfetchheadererrors", 0);
+
+try {
+ imap_fetchheader($imap_mail_box, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ imap_fetchheader($imap_mail_box, 1, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+// Access not existing
+var_dump(imap_fetchheader($imap_mail_box, 255));
+var_dump(imap_fetchheader($imap_mail_box, 255, FT_UID));
+
+imap_close($imap_mail_box);
+
+?>
+--CLEAN--
+<?php
+$mailbox_suffix = 'imapfetchheadererrors';
+require_once(__DIR__ . '/setup/clean.inc');
+?>
+--EXPECTF--
+Create a temporary mailbox and add 0 msgs
+New mailbox created
+imap_fetchheader(): Argument #2 ($message_num) must be greater than 0
+imap_fetchheader(): Argument #3 ($flags) must be a bitmask of FT_UID, FT_PREFETCHTEXT, and FT_INTERNAL
+
+Warning: imap_fetchheader(): Bad message number in %s on line %d
+bool(false)
+
+Warning: imap_fetchheader(): UID does not exist in %s on line %d
+bool(false)
diff --git a/ext/imap/tests/imap_fetchmime_errors.phpt b/ext/imap/tests/imap_fetchmime_errors.phpt
new file mode 100644
index 0000000000..d99168a708
--- /dev/null
+++ b/ext/imap/tests/imap_fetchmime_errors.phpt
@@ -0,0 +1,49 @@
+--TEST--
+imap_fetchmime() errors: ValueError and Warnings
+--SKIPIF--
+<?php
+require_once(__DIR__.'/setup/skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once(__DIR__.'/setup/imap_include.inc');
+
+$imap_mail_box = setup_test_mailbox("imapfetchmimeerrors", 0);
+
+$section = '';
+
+try {
+ imap_fetchmime($imap_mail_box, -1, $section);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ imap_fetchmime($imap_mail_box, 1, $section, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+// Access not existing
+var_dump(imap_fetchmime($imap_mail_box, 255, $section));
+var_dump(imap_fetchmime($imap_mail_box, 255, $section, FT_UID));
+
+imap_close($imap_mail_box);
+
+?>
+--CLEAN--
+<?php
+$mailbox_suffix = 'imapfetchmimeerrors';
+require_once(__DIR__ . '/setup/clean.inc');
+?>
+--EXPECTF--
+Create a temporary mailbox and add 0 msgs
+New mailbox created
+imap_fetchmime(): Argument #2 ($message_num) must be greater than 0
+imap_fetchmime(): Argument #4 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL
+
+Warning: imap_fetchmime(): Bad message number in %s on line %d
+bool(false)
+
+Warning: imap_fetchmime(): UID does not exist in %s on line %d
+bool(false)
diff --git a/ext/imap/tests/imap_fetchstructure_errors.phpt b/ext/imap/tests/imap_fetchstructure_errors.phpt
new file mode 100644
index 0000000000..4e834fa2c4
--- /dev/null
+++ b/ext/imap/tests/imap_fetchstructure_errors.phpt
@@ -0,0 +1,47 @@
+--TEST--
+imap_fetchstructure() errors: ValueError and Warnings
+--SKIPIF--
+<?php
+require_once(__DIR__.'/setup/skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once(__DIR__.'/setup/imap_include.inc');
+
+$imap_mail_box = setup_test_mailbox("imapfetchstructureerrors", 0);
+
+try {
+ imap_fetchstructure($imap_mail_box, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ imap_fetchstructure($imap_mail_box, 1, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+// Access not existing
+var_dump(imap_fetchstructure($imap_mail_box, 255));
+var_dump(imap_fetchstructure($imap_mail_box, 255, FT_UID));
+
+imap_close($imap_mail_box);
+
+?>
+--CLEAN--
+<?php
+$mailbox_suffix = 'imapfetchstructureerrors';
+require_once(__DIR__ . '/setup/clean.inc');
+?>
+--EXPECTF--
+Create a temporary mailbox and add 0 msgs
+New mailbox created
+imap_fetchstructure(): Argument #2 ($message_num) must be greater than 0
+imap_fetchstructure(): Argument #3 ($flags) must be FT_UID or 0
+
+Warning: imap_fetchstructure(): Bad message number in %s on line %d
+bool(false)
+
+Warning: imap_fetchstructure(): UID does not exist in %s on line %d
+bool(false)
diff --git a/ext/imap/tests/imap_savebody_errors.phpt b/ext/imap/tests/imap_savebody_errors.phpt
new file mode 100644
index 0000000000..e7cff603f6
--- /dev/null
+++ b/ext/imap/tests/imap_savebody_errors.phpt
@@ -0,0 +1,49 @@
+--TEST--
+imap_savebody() errors: ValueError and Warnings
+--SKIPIF--
+<?php
+require_once(__DIR__.'/setup/skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once(__DIR__.'/setup/imap_include.inc');
+
+$imap_mail_box = setup_test_mailbox("imapsavebodyerrors", 0);
+
+$section = '';
+
+try {
+ imap_savebody($imap_mail_box, '', -1, $section);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ imap_savebody($imap_mail_box, '', 1, $section, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+// Access not existing
+var_dump(imap_savebody($imap_mail_box, '', 255, $section));
+var_dump(imap_savebody($imap_mail_box, '', 255, $section, FT_UID));
+
+imap_close($imap_mail_box);
+
+?>
+--CLEAN--
+<?php
+$mailbox_suffix = 'imapsavebodyerrors';
+require_once(__DIR__ . '/setup/clean.inc');
+?>
+--EXPECTF--
+Create a temporary mailbox and add 0 msgs
+New mailbox created
+imap_savebody(): Argument #3 ($message_num) must be greater than 0
+imap_savebody(): Argument #5 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL
+
+Warning: imap_savebody(): Bad message number in %s on line %d
+bool(false)
+
+Warning: imap_savebody(): UID does not exist in %s on line %d
+bool(false)