summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2021-02-27 13:14:23 +0000
committerGeorge Peter Banyard <girgias@php.net>2021-02-27 13:14:23 +0000
commitbfd3fda0f4d25dc70580ebcd193ef3b141524b62 (patch)
tree64c38c62a3f1fd0c461d193968f37c28cba990df /ext/imap/php_imap.c
parent6c5942f83590e622b0e59e388912c67a51ea7bb7 (diff)
parent1ee6aad248117312fdc9ff7edc3ddd7bd5203d79 (diff)
downloadphp-git-bfd3fda0f4d25dc70580ebcd193ef3b141524b62.tar.gz
Merge branch 'PHP-8.0'
* PHP-8.0: Fix Bug #80800 imap_open() fails when the flags parameter includes CL_EXPUNGE
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index e62d6f7b2a..9a1ded643b 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -782,7 +782,11 @@ PHP_FUNCTION(imap_open)
RETURN_THROWS();
}
- if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | CL_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
+ /* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
+ * to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
+ * the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
+ * IMAPConnection object being destroyed naturally at the end of the PHP script */
+ if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | PHP_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
| OP_SILENT | OP_PROTOTYPE | OP_SECURE)) != 0)) {
zend_argument_value_error(4, "must be a bitmask of the OP_* constants, and CL_EXPUNGE");
RETURN_THROWS();
@@ -901,7 +905,11 @@ PHP_FUNCTION(imap_reopen)
GET_IMAP_STREAM(imap_conn_struct, imap_conn_obj);
/* TODO Verify these are the only options available as they are pulled from the php.net documentation */
- if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | CL_EXPUNGE)) != 0)) {
+ /* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
+ * to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
+ * the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
+ * IMAPConnection object being destroyed naturally at the end of the PHP script */
+ if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | PHP_EXPUNGE)) != 0)) {
zend_argument_value_error(3, "must be a bitmask of OP_READONLY, OP_ANONYMOUS, OP_HALFOPEN, "
"OP_EXPUNGE, and CL_EXPUNGE");
RETURN_THROWS();