File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ static void imap_object_destroy(zend_object *zobj) {
207
207
208
208
#define GET_IMAP_STREAM (imap_conn_struct , zval_imap_obj ) \
209
209
imap_conn_struct = imap_object_from_zend_object(Z_OBJ_P(zval_imap_obj)); \
210
- if (! imap_conn_struct) { \
210
+ if (imap_conn_struct->imap_stream == NULL ) { \
211
211
zend_throw_exception(zend_ce_value_error, "IMAP\\Connection is already closed", 0); \
212
212
RETURN_THROWS(); \
213
213
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug GH-9309 (Segfault when connection is used after imap_close())
3
+ --EXTENSIONS--
4
+ imap
5
+ --SKIPIF--
6
+ <?php
7
+ require_once (__DIR__ .'/setup/skipif.inc ' );
8
+ ?>
9
+ --FILE--
10
+ <?php
11
+ require_once (__DIR__ .'/setup/imap_include.inc ' );
12
+ $ stream_id = setup_test_mailbox ('gh9309 ' , 0 , $ mailbox );
13
+ imap_close ($ stream_id );
14
+ try {
15
+ imap_headers ($ stream_id );
16
+ } catch (ValueError $ ex ) {
17
+ echo $ ex ->getMessage (), PHP_EOL ;
18
+ }
19
+ ?>
20
+ --CLEAN--
21
+ <?php
22
+ $ mailbox_suffix = 'gh9309 ' ;
23
+ require_once (__DIR__ .'/setup/clean.inc ' );
24
+ ?>
25
+ --EXPECT--
26
+ Create a temporary mailbox and add 0 msgs
27
+ New mailbox created
28
+ IMAP\Connection is already closed
You can’t perform that action at this time.
0 commit comments