diff options
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r-- | ext/imap/php_imap.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index c561a5e72c..023795fd8c 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -2835,10 +2835,10 @@ PHP_FUNCTION(imap_uid) PHP_FUNCTION(imap_msgno) { zval *streamind; - zend_long msgno; + zend_long msg_uid; pils *imap_le_struct; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &streamind, &msgno) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &streamind, &msg_uid) == FAILURE) { RETURN_THROWS(); } @@ -2846,9 +2846,13 @@ PHP_FUNCTION(imap_msgno) RETURN_THROWS(); } - PHP_IMAP_CHECK_MSGNO(msgno, 2); + /* Do NOT use the PHP_IMAP_CHECK_MSGNO() macro as UID cannot be checked for their upper bound. */ + if (msg_uid < 1) { + zend_argument_value_error(2, "must be greater than 0"); + RETURN_THROWS(); + } - RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno)); + RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msg_uid)); } /* }}} */ |