MimeTypeGuesser::guess() is deprecated, D10 compatibility

Created on 17 April 2023, over 1 year ago
Updated 25 April 2024, 7 months ago

Problem/Motivation

My configurations:
- Drupal 10.0.7
- PHP 8.1.13
- Mimemail 8.x-1.0-alpha5

There is deprecated code in src/Utility/MimeMailFormatHelper.php. (line 452 and line 685).
https://www.drupal.org/node/3126004 β†’

This prevent the email from being sent. The module works when I replace the lines with guessMimeType().

Error: Call to undefined method Drupal\Core\ProxyClass\File\MimeType\MimeTypeGuesser::guess() in Drupal\mimemail\Utility\MimeMailFormatHelper::mimeMailFile() (line 452 of /web/modules/contrib/mimemail/src/Utility/MimeMailFormatHelper.php).

Proposed resolution

guess() needs to be replaced by guessMimeType()

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada mlanteigne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mlanteigne
  • Status changed to Closed: duplicate over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Please help with ✨ Improve image detection Needs work

  • Status changed to Active over 1 year ago
  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ

    I understand that this issue should be fixed together with ✨ Improve image detection Needs work .
    But that issue is not solved since months. So mimemail causes PHP fatal errors on Drupal 10.0 and 10.1 while it pretends to be compatible to Drupal ^10.
    Therefore, I suggest to fix that fatal error first.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    27 pass
  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ
  • Status changed to Closed: duplicate over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    So help solve that issue. Part of the problem is that there is not sufficient testing, which is why that other issue needs to be fixed and which is why a band-aid like you propose is not a sustainable solution for this module going forward.

  • πŸ‡¨πŸ‡¦Canada leducdubleuet Chicoutimi QC

    @mkalkbrenner
    Thanks a lot for the band-aid in comment #4, it helps going forward while the other issue is worked on!

    @TR
    I'll have a look at that other issue to see if I can help.

  • πŸ‡¨πŸ‡¦Canada leducdubleuet Chicoutimi QC

    @TR
    I understand that you want it clean with the testing and all but Drupal 9 is not supported anymore and we really need a functional D10 version of this module. It has been more than 8 months and no work has been done on the other issue #3155325: Improve image detection...

    So I am asking if it would it be possible to release a D10 version even if the band-aid solution is not ideal please?

  • Status changed to Needs review about 1 year ago
  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ

    I totally agree with @LeDucDuBleuet

    I re-open this issue to help others, because Drupal 9 reached EOL.
    I also set the priority back to Critical, because mails aren't sent.

  • πŸ‡«πŸ‡·France tido Montpellier

    Can you tell me if this issue will soon be included in the release?

    I can confirm that sending emails with an attachment provided in #attachments fails if this patch is not present with Drupal 10.2.2 / PHP 8.2 / Mimemail 8.x-1.0-alpha6.

  • Status changed to RTBC 7 months ago
  • πŸ‡¨πŸ‡¦Canada leducdubleuet Chicoutimi QC

    This patch has been tested successfully for more than 6 months now on many websites, I can confirm it is RTBC.

    @TR
    It has been more than a year now, while not ideal, could we have a new release including this patch please?

    Thank you very much.

Production build 0.71.5 2024