Skip to content

Commit

Permalink
Carbon Exception Parse Data #45
Browse files Browse the repository at this point in the history
  • Loading branch information
Webklex committed Jul 21, 2018
1 parent 2b4c463 commit 572d7bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/IMAP/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,9 @@ private function parseHeader() {
$this->date = Carbon::parse($date);
} catch (\Exception $e) {
switch (true) {
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ \+[0-9]{4}\ \(.*)\)+$/i', $date) > 0:
$array = explode('(', $date);
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4}\ \(.*)\)+$/i', $date) > 0:
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{2,4}\ [0-9]{2}\:[0-9]{2}\:[0-9]{2}\ [A-Z]{2}\ \-[0-9]{2}\:[0-9]{2}\ \([A-Z]{2,3}\ \-[0-9]{2}:[0-9]{2}\))+$/i', $date) > 0:
$array = explode('(', $date);
$array = array_reverse($array);
$date = trim(array_pop($array));
break;
Expand Down

0 comments on commit 572d7bd

Please sign in to comment.