Skip to content

Commit 9412504

Browse files
committed
More explicit date validation statements
1 parent 0ae9154 commit 9412504

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/IMAP/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ private function parseHeader() {
257257
$this->date = Carbon::parse($date);
258258
}catch(\Exception $e){
259259
switch(true){
260-
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}\ \([A-Z]{2,3}\+[0-9]{1,2}\:[0-9]{1,2})\)+$/i', $date):
260+
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}\ \([A-Z]{2,3}\+[0-9]{1,2}\:[0-9]{1,2})\)+$/i', $date) > 0:
261261
$array = explode('(', $date);
262262
$array = array_reverse($array);
263263
$date = trim(array_pop($array));
264264
break;
265-
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ UT)+$/i', $date):
265+
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ UT)+$/i', $date) > 0:
266266
$date .= 'C';
267267
break;
268268
}

0 commit comments

Comments
 (0)