Skip to content

Commit c210fb1

Browse files
Merge pull request #1 from Webklex/master
Changes from original repo
2 parents 5800da4 + 5437529 commit c210fb1

File tree

8 files changed

+39
-26
lines changed

8 files changed

+39
-26
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,29 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
1717
### Breaking changes
1818
- NaN
1919

20+
## [2.4.2] - 2021-01-09
21+
### Fixed
22+
- Attachment::save() return error 'A facade root has not been set' #87
23+
- Unused dependencies removed
24+
- Fix PHP 8 error that changes null back in to an empty string. #88 (thanks @mennovanhout)
25+
- Fix regex to be case insensitive #88 (thanks @mennovanhout)
26+
27+
### Affected Classes
28+
- [Attachment::class](src/Attachment.php)
29+
- [Address::class](src/Address.php)
30+
- [Attribute::class](src/Attribute.php)
31+
- [Structure::class](src/Structure.php)
32+
33+
## [2.4.1] - 2021-01-06
34+
### Fixed
35+
- Debug line position fixed
36+
- Handle incomplete address to string conversion #83
37+
- Configured message key gets overwritten by the first fetched message #84
38+
39+
### Affected Classes
40+
- [Address::class](src/Address.php)
41+
- [Query::class](src/Query/Query.php)
42+
2043
## [2.4.0] - 2021-01-03
2144
### Fixed
2245
- Get partial overview when `IMAP::ST_UID` is set #74

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[![Latest Version on Packagist][ico-version]][link-packagist]
55
[![Software License][ico-license]][link-license]
6-
[![Build Status][ico-build]][link-scrutinizer]
6+
[![Build Status][ico-travis]][link-scrutinizer]
77
[![Total Downloads][ico-downloads]][link-downloads]
88
[![Hits][ico-hits]][link-hits]
99

src/Address.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212

1313
namespace Webklex\PHPIMAP;
1414

15-
use Illuminate\Support\Str;
16-
use Illuminate\Support\Facades\File;
17-
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
18-
use Webklex\PHPIMAP\Exceptions\MethodNotFoundException;
19-
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
20-
2115
/**
2216
* Class Address
2317
*

src/Attachment.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Webklex\PHPIMAP;
1414

1515
use Illuminate\Support\Str;
16-
use Illuminate\Support\Facades\File;
1716
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
1817
use Webklex\PHPIMAP\Exceptions\MethodNotFoundException;
1918
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
@@ -246,7 +245,7 @@ protected function fetch() {
246245
public function save($path, $filename = null) {
247246
$filename = $filename ?: $this->getName();
248247

249-
return File::put($path.$filename, $this->getContent()) !== false;
248+
return file_put_contents($path.$filename, $this->getContent()) !== false;
250249
}
251250

252251
/**

src/Attribute.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212

1313
namespace Webklex\PHPIMAP;
1414

15-
use Illuminate\Support\Str;
16-
use Illuminate\Support\Facades\File;
17-
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
18-
use Webklex\PHPIMAP\Exceptions\MethodNotFoundException;
19-
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
20-
2115
/**
2216
* Class Attribute
2317
*

src/Connection/Protocols/ImapProtocol.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public function readLine(&$tokens = [], $wantedTag = '*', $dontParse = false) {
233233
} else {
234234
$tokens = $line;
235235
}
236+
if ($this->debug) echo "<< ".$line."\n";
236237

237238
// if tag is wanted tag we might be at the end of a multiline response
238239
return $tag == $wantedTag;
@@ -257,11 +258,6 @@ public function readResponse($tag, $dontParse = false) {
257258
// First two chars are still needed for the response code
258259
$tokens = [substr($tokens, 0, 2)];
259260
}
260-
if (is_array($lines)){
261-
if ($this->debug) echo "<< ".json_encode($lines)."\n";
262-
}else{
263-
if ($this->debug) echo "<< ".$lines."\n";
264-
}
265261

266262
// last line has response code
267263
if ($tokens[0] == 'OK') {

src/Query/Query.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,20 @@ public function get() {
242242
$message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence);
243243
switch ($message_key){
244244
case 'number':
245-
$message_key = $message->getMessageNo();
245+
$key = $message->getMessageNo();
246246
break;
247247
case 'list':
248-
$message_key = $msglist;
248+
$key = $msglist;
249249
break;
250250
case 'uid':
251-
$message_key = $message->getUid();
251+
$key = $message->getUid();
252252
break;
253253
default:
254-
$message_key = $message->getMessageId();
254+
$key = $message->getMessageId();
255255
break;
256256

257257
}
258-
$messages->put("$message_key", $message);
258+
$messages->put("$key", $message);
259259
$msglist++;
260260
}
261261
}

src/Structure.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,16 @@ public function findContentType(){
9898

9999
/**
100100
* Determine the message content type
101+
*
102+
* @return string|null
101103
*/
102104
public function getBoundary(){
103-
$boundary = $this->header->find("/boundary=\"?([^\"]*)[\";\s]/");
105+
$boundary = $this->header->find("/boundary=\"?([^\"]*)[\";\s]/i");
106+
107+
if ($boundary === null) {
108+
return null;
109+
}
110+
104111
return str_replace('"', '', $boundary);
105112
}
106113

0 commit comments

Comments
 (0)