Skip to content

Commit d56c3b2

Browse files
parshikovWebklex
authored andcommitted
Fix assignment msgno to uid regardless of fetch_options is set in config (#39)
* Fix uid assigning logic ```Message:: __construct(...);``` without ```fetch_options``` parameter caused running ```imap_msgno``` function even ```FT_UID``` is set in config. * Fix wrong option assignment logic The alternative branch will never be called. * Update CHANGELOD.md
1 parent b72b2ed commit d56c3b2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
66

77
## [UNRELEASED]
88
### Fixed
9-
- NaN
9+
- Fix assignment ```msgno``` to ```uid``` regardless of ```fetch_options``` is set in config
1010

1111
### Added
1212
- NaN
1313

1414
### Affected Classes
15-
- All
15+
- [Message::class](src/IMAP/Message.php)
1616

1717
## [1.0.3.6] - 2017-10-24
1818
### Added

src/IMAP/Message.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,12 @@ class Message {
127127
* @param $fetch_options
128128
*/
129129
public function __construct($uid, $msglist, Client $client, $fetch_options = null) {
130+
$this->setFetchOption($fetch_options);
131+
130132
$this->msglist = $msglist;
131133
$this->client = $client;
132-
$this->uid = ($fetch_options == FT_UID) ? $uid : imap_msgno($this->client->getConnection(), $uid);
133-
134-
$this->setFetchOption($fetch_options);
134+
$this->uid = ($this->fetch_options == FT_UID) ? $uid : imap_msgno($this->client->getConnection(), $uid);
135+
135136
$this->parseHeader();
136137
$this->parseBody();
137138
}
@@ -454,7 +455,6 @@ protected function fetchAttachment($structure, $partNumber){
454455
* @return $this
455456
*/
456457
public function setFetchOption($option){
457-
$option = (integer)$option;
458458
if(is_long($option) == true){
459459
$this->fetch_options = $option;
460460
}elseif(is_null($option) == true){

0 commit comments

Comments
 (0)