You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-12-18 09:46:15

BNITM
Member
Registered: 2023-12-15
Posts: 1

Date-Header of incoming emails could not be parsed correctly.

Dear all,

I just noticed that an email containing this kind of date header could not be parsed correctly and leads to an mysql error:

Date: Tue, 12 Dec 2023 08:56:19 +0100 (GMT+01:00)

The MySQL error is:

  *** MySQL query error:
  SQL: INSERT INTO `glpi_tickets` (`date`, `name`, `content`, `urgency`, `requesttypes_id`, `entities_id`, `status`, `impact`, `priority`, `itilcategories_id`, `global_validation`, `type`, `date_creation`, `date_mod`) VALUES ('1970-01-01 00:00:00', 'Test date', '<html>\n <head>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n </head>\n <body></body>\n</html>', '3', '2', '0', '1', '3', '3', '0', '1', '1', '2023-12-15 09:29:01', '2023-12-15 09:29:01')
  Error: Incorrect datetime value: '1970-01-01 00:00:00' for column `glpi0`.`glpi_tickets`.`date` at row 1

I made a quick research in the source and found in line 1513 of src/MailCollector.php (Release 10.0.11) that      $date         = date("Y-m-d H:i:s", strtotime($message->date)); will fail on this date format (I check this here strtotime.co.uk/?str=Tue%2C+12+Dec+2023+08%3A56%3A19+%2B0100+%28GMT%2B01%3A00%29)

The failing mail was sent by the Fairmail android app, I had a chat with the developer and he said that the date header complies to the RFC. Anyway,  would it be possibile to implement are more failsafe parsing here?

Best regards
Markus

Offline

Board footer

Powered by FluxBB