From: Jani Taskinen Date: Mon, 3 Aug 2009 13:02:53 +0000 (+0000) Subject: - Fixed bug #48400 (imap crashes when closing stream opened with OP_PROTOTYPE flag) X-Git-Tag: php-5.4.0alpha1~191^2~2877 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=856b6eef7882bca96b1d45c0841179b63b09446e;p=php - Fixed bug #48400 (imap crashes when closing stream opened with OP_PROTOTYPE flag) --- 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)) {