Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid timestamp #392

Closed
esk-ap opened this issue Mar 17, 2023 · 2 comments
Closed

Invalid timestamp #392

esk-ap opened this issue Mar 17, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@esk-ap
Copy link

esk-ap commented Mar 17, 2023

Invalid timestamp "Thur, 16 Mar 2023 15:33:07 +0400"
trowing exception

Invalid message date. ID:owsm3402918.1678969748@portal.moskvorechie.ru Date:Thur, 16 Mar 2023 15:33:07 +0400/Thur, 16 Mar 2023 15:33:07 +0400

  at vendor/webklex/php-imap/src/Header.php:752
    748▕                 try {
    749▕                     $parsed_date = Carbon::parse($date);
    750▕                 } catch (\Exception $_e) {
    751▕                     if (!isset($this->config["fallback_date"])) {
  ➜ 752▕                         throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e);
    753▕                     } else {
    754▕                         $parsed_date = Carbon::parse($this->config["fallback_date"]);
    755▕                     }
    756▕                 }
@esk-ap
Copy link
Author

esk-ap commented Mar 17, 2023

add this to fix the problem after second case

                   case preg_match('/([A-Z]{2,4}\,\ [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);
                        $array = array_reverse($array);
                        $date = trim(implode(',', $array));
                        break;

@Webklex Webklex added the enhancement New feature or request label Jun 23, 2023
Webklex added a commit that referenced this issue Jun 23, 2023
@Webklex
Copy link
Owner

Webklex commented Jun 23, 2023

Hi @esk-ap ,
many thanks for your report and suggested addition.

Thanks for taking the time and effort to make this library better! If you have any more questions or need further assistance, feel free to let me know.

Best regards and happy coding!

@Webklex Webklex closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants