@@ -735,7 +735,11 @@ PHP_FUNCTION(imap_open)
735
735
RETURN_THROWS ();
736
736
}
737
737
738
- if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | CL_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
738
+ /* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
739
+ * to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
740
+ * the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
741
+ * IMAPConnection object being destroyed naturally at the end of the PHP script */
742
+ if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | PHP_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
739
743
| OP_SILENT | OP_PROTOTYPE | OP_SECURE )) != 0 )) {
740
744
zend_argument_value_error (4 , "must be a bitmask of the OP_* constants, and CL_EXPUNGE" );
741
745
RETURN_THROWS ();
@@ -858,7 +862,11 @@ PHP_FUNCTION(imap_reopen)
858
862
}
859
863
860
864
/* TODO Verify these are the only options available as they are pulled from the php.net documentation */
861
- if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | CL_EXPUNGE )) != 0 )) {
865
+ /* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
866
+ * to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
867
+ * the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
868
+ * IMAPConnection object being destroyed naturally at the end of the PHP script */
869
+ if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | PHP_EXPUNGE )) != 0 )) {
862
870
zend_argument_value_error (3 , "must be a bitmask of OP_READONLY, OP_ANONYMOUS, OP_HALFOPEN, "
863
871
"OP_EXPUNGE, and CL_EXPUNGE" );
864
872
RETURN_THROWS ();
0 commit comments