]> granicus.if.org Git - php/commitdiff
- Fixed bug #48400 (imap crashes when closing stream opened with OP_PROTOTYPE flag)
authorJani Taskinen <jani@php.net>
Mon, 3 Aug 2009 13:02:53 +0000 (13:02 +0000)
committerJani Taskinen <jani@php.net>
Mon, 3 Aug 2009 13:02:53 +0000 (13:02 +0000)
ext/imap/php_imap.c

index f8b2d4b9a675e13be6fd4c8d57cf358e71114301..185f3fce4830fc0f9ea15263e79add56dc13ec1c 100644 (file)
@@ -597,7 +597,10 @@ static void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
        pils *imap_le_struct = (pils *)rsrc->ptr;
 
-       mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags);
+       /* Do not try to close prototype streams */
+       if (!(imap_le_struct->flags & OP_PROTOTYPE)) {
+               mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags);
+       }
 
        if (IMAPG(imap_user)) {
                efree(IMAPG(imap_user));
@@ -1154,6 +1157,9 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
                        cl_flags = CL_EXPUNGE;
                        flags ^= PHP_EXPUNGE;
                }
+               if (flags & OP_PROTOTYPE) {
+                       cl_flags |= OP_PROTOTYPE;
+               }
        }
 
        if (IMAPG(imap_user)) {