File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
66
77## [ UNRELEASED]
88### Fixed
9- - NaN
9+ - # 41 imap_expunge(): supplied resource is not a valid imap resource
1010
1111### Added
1212- NaN
Original file line number Diff line number Diff line change @@ -86,6 +86,12 @@ class Client {
8686 */
8787 protected $ activeFolder = false ;
8888
89+ /**
90+ * Connected parameter
91+ * @var bool
92+ */
93+ protected $ connected = false ;
94+
8995 /**
9096 * Client constructor.
9197 *
@@ -148,7 +154,7 @@ public function setReadOnly($readOnly = true) {
148154 * @return bool
149155 */
150156 public function isConnected () {
151- return ( $ this ->connection ) ? true : false ;
157+ return $ this ->connected ;
152158 }
153159
154160 /**
@@ -191,6 +197,7 @@ public function connect($attempts = 3) {
191197 $ attempts ,
192198 config ('imap.options.open ' )
193199 );
200+ $ this ->connected = !! $ this ->connection ;
194201 } catch (\ErrorException $ e ) {
195202 $ errors = imap_errors ();
196203 $ message = $ e ->getMessage ().'. ' .implode ("; " , (is_array ($ errors ) ? $ errors : array ()));
@@ -208,8 +215,7 @@ public function connect($attempts = 3) {
208215 */
209216 public function disconnect () {
210217 if ($ this ->isConnected ()) {
211- $ this ->expunge ();
212- imap_close ($ this ->connection );
218+ $ this ->connected = ! imap_close ($ this ->connection , CL_EXPUNGE );
213219 }
214220
215221 return $ this ;
@@ -462,4 +468,4 @@ public function expunge(){
462468 public function checkCurrentMailbox (){
463469 return imap_check ($ this ->connection );
464470 }
465- }
471+ }
You can’t perform that action at this time.
0 commit comments