@@ -294,19 +294,22 @@ public function readResponse(Response $response, string $tag, bool $dontParse =
294
294
$ lines [] = $ tokens ;
295
295
} while (!$ readAll );
296
296
297
+ $ original = $ tokens ;
297
298
if ($ dontParse ) {
298
299
// First two chars are still needed for the response code
299
300
$ tokens = [substr ($ tokens , 0 , 2 )];
300
301
}
301
302
303
+ $ original = is_array ($ original )?$ original : [$ original ];
304
+
302
305
// last line has response code
303
306
if ($ tokens [0 ] == 'OK ' ) {
304
307
return $ lines ?: [true ];
305
308
} elseif ($ tokens [0 ] == 'NO ' || $ tokens [0 ] == 'BAD ' || $ tokens [0 ] == 'BYE ' ) {
306
- throw new ImapServerErrorException (implode ("\n" , $ tokens ));
309
+ throw new ImapServerErrorException (implode ("\n" , $ original ));
307
310
}
308
311
309
- throw new ImapBadRequestException (implode ("\n" , $ tokens ));
312
+ throw new ImapBadRequestException (implode ("\n" , $ original ));
310
313
}
311
314
312
315
/**
@@ -730,7 +733,7 @@ public function fetch(array|string $items, array|int $from, mixed $to = null, in
730
733
* @throws RuntimeException
731
734
*/
732
735
public function content (int |array $ uids , string $ rfc = "RFC822 " , int |string $ uid = IMAP ::ST_UID ): Response {
733
- return $ this ->fetch (["$ rfc.TEXT " ], $ uids , null , $ uid );
736
+ return $ this ->fetch (["$ rfc.TEXT " ], is_array ( $ uids)? $ uids :[ $ uids ] , null , $ uid );
734
737
}
735
738
736
739
/**
@@ -744,7 +747,7 @@ public function content(int|array $uids, string $rfc = "RFC822", int|string $uid
744
747
* @throws RuntimeException
745
748
*/
746
749
public function headers (int |array $ uids , string $ rfc = "RFC822 " , int |string $ uid = IMAP ::ST_UID ): Response {
747
- return $ this ->fetch (["$ rfc.HEADER " ], $ uids , null , $ uid );
750
+ return $ this ->fetch (["$ rfc.HEADER " ], is_array ( $ uids)? $ uids :[ $ uids ] , null , $ uid );
748
751
}
749
752
750
753
/**
@@ -757,7 +760,7 @@ public function headers(int|array $uids, string $rfc = "RFC822", int|string $uid
757
760
* @throws RuntimeException
758
761
*/
759
762
public function flags (int |array $ uids , int |string $ uid = IMAP ::ST_UID ): Response {
760
- return $ this ->fetch (["FLAGS " ], $ uids , null , $ uid );
763
+ return $ this ->fetch (["FLAGS " ], is_array ( $ uids)? $ uids :[ $ uids ] , null , $ uid );
761
764
}
762
765
763
766
/**
@@ -770,7 +773,7 @@ public function flags(int|array $uids, int|string $uid = IMAP::ST_UID): Response
770
773
* @throws RuntimeException
771
774
*/
772
775
public function sizes (int |array $ uids , int |string $ uid = IMAP ::ST_UID ): Response {
773
- return $ this ->fetch (["RFC822.SIZE " ], $ uids , null , $ uid );
776
+ return $ this ->fetch (["RFC822.SIZE " ], is_array ( $ uids)? $ uids :[ $ uids ] , null , $ uid );
774
777
}
775
778
776
779
/**
0 commit comments