From 856b6eef7882bca96b1d45c0841179b63b09446e Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Mon, 3 Aug 2009 13:02:53 +0000 Subject: [PATCH] - Fixed bug #48400 (imap crashes when closing stream opened with OP_PROTOTYPE flag) --- ext/imap/php_imap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index f8b2d4b9a6..185f3fce48 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -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)) { -- 2.50.1