Skip to content

Commit

Permalink
Merge pull request #327 from barbushin/develop
Browse files Browse the repository at this point in the history
Fixed PHPUnit tests, setConnectionArgs() and string encoding
  • Loading branch information
Sebbo94BY committed May 18, 2019
2 parents 72ead4e + 3f3e3ee commit b23e99b
Show file tree
Hide file tree
Showing 3 changed files with 432 additions and 440 deletions.
2 changes: 1 addition & 1 deletion src/PhpImap/DataPartInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function fetch() {
}

if(isset($this->charset) AND !empty($this->charset)) {
$this->data = $this->mail->decodeMimeStr($this->data, $this->charset);
$this->data = $this->mail->convertStringEncoding($this->data, $this->charset, $this->mail->getServerEncoding());
}

return $this->data;
Expand Down
6 changes: 3 additions & 3 deletions src/PhpImap/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function setConnectionArgs($options = 0, $retriesNum = 0, $params = NULL)
if($options != 0) {
$supported_options = array(OP_READONLY, OP_ANONYMOUS, OP_HALFOPEN, CL_EXPUNGE, OP_DEBUG, OP_SHORTCACHE, OP_SILENT, OP_PROTOTYPE, OP_SECURE);
if(!in_array($options, $supported_options)) {
throw new InvalidParameterException('Please check your options for setConnectionArgs()! You have provided an unsupported option. Available options: https://www.php.net/manual/de/function.imap-open.php');
throw new InvalidParameterException('Please check your option for setConnectionArgs()! Unsupported option "'.$options.'". Available options: https://www.php.net/manual/de/function.imap-open.php');
}
$this->imapOptions = $options;
}
Expand All @@ -210,14 +210,14 @@ public function setConnectionArgs($options = 0, $retriesNum = 0, $params = NULL)
$this->imapRetriesNum = $retriesNum;
}

if($params != NULL AND !empty(is_array($params))) {
if($params != NULL AND !empty($params)) {
$supported_params = array('DISABLE_AUTHENTICATOR');
if(!is_array($params)) {
throw new InvalidParameterException('setConnectionArgs() requires $params to be an array!');
}

foreach($params as $key => $value) {
if(!array_key_exists($key, $supported_params)) {
if(!in_array($key, $supported_params)) {
throw new InvalidParameterException('Invalid array key of params provided for setConnectionArgs()! Only DISABLE_AUTHENTICATOR is currently valid.');
}
}
Expand Down
Loading

0 comments on commit b23e99b

Please sign in to comment.