php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63723 make use of UID EXPUNGE
Submitted: 2012-12-07 19:53 UTC Modified: -
Votes:2
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: slim at inbox dot lv Assigned:
Status: Open Package: IMAP related
PHP Version: 5.3.19 OS: l
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: slim at inbox dot lv
New email:
PHP Version: OS:

 

 [2012-12-07 19:53 UTC] slim at inbox dot lv
Description:
------------
c-client supports UID EXPUNGE feature from RFC 4315
Following patch adds the functionality to imap_expunge() when UID is set as 
second argument:

diff -ur php-5.3.17.orig/ext/imap/php_imap.c php-5.3.17/ext/imap/php_imap.c
--- php-5.3.17.orig/ext/imap/php_imap.c 2012-10-29 17:49:28.000000000 +0200
+++ php-5.3.17/ext/imap/php_imap.c      2012-12-06 11:11:41.000000000 +0200
@@ -166,7 +166,8 @@
 #endif
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_expunge, 0, 0, 1)
-       ZEND_ARG_INFO(0, stream_id)
+        ZEND_ARG_INFO(0, stream_id)
+        ZEND_ARG_INFO(0, sequence)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_gc, 0, 0, 1)
@@ -1137,6 +1138,7 @@
 #if HAVE_IMAP_KRB && HAVE_IMAP_AUTH_GSS
        php_info_print_table_row(2, "Kerberos Support", "enabled");
 #endif
+       php_info_print_table_row(2, "IMAP UIDEXPUNGE Support", "enabled");
        php_info_print_table_end();
 }
 /* }}} */
@@ -1553,18 +1555,23 @@
    Permanently delete all messages marked for deletion */
 PHP_FUNCTION(imap_expunge)
 {
-       zval *streamind;
-       pils *imap_le_struct;
+       zval *streamind;
+       char *sequence;
+       long flags = 0x1;
+       int sequence_len;
+       int argc = ZEND_NUM_ARGS();
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &streamind) == 
FAILURE) {
-               return;
-       }
+        pils *imap_le_struct;
 
-       ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", 
le_imap);
+        if (zend_parse_parameters(argc TSRMLS_CC, "r|s", &streamind, &sequence, 
&sequence_len) == FAILURE) {
+                return;
+        }
 
-       mail_expunge (imap_le_struct->imap_stream);
+        ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", 
le_imap);
 
-       RETURN_TRUE;
+        mail_expunge_full (imap_le_struct->imap_stream, (argc == 2 ? sequence : 
NIL), (argc == 2 ? flags : NIL));
+
+        RETURN_TRUE;
 }
 /* }}} */
 

Test script:
---------------
imap_expunge(resource $imap_stream, int $uid)


Patches

Pull Requests

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Feb 18 01:01:29 2025 UTC