Problem/Motivation

While trying to upgrade my website to D9, i ran the upgrade-status module.
This error pointed out

Mobile Detect 8.x-2.4
Scanned on jeu 15/10/2020 - 10:33.

4 warnings found.

Mobile Detect already works with Drupal 9.

web/modules/contrib/mobile_detect/mobile_detect.module:

Mobile Detect 8.x-2.4
Scanned on jeu 15/10/2020 - 10:33.

4 warnings found.

Mobile Detect already works with Drupal 9.

web/modules/contrib/mobile_detect/mobile_detect.module:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│  STATUS  │ LINE │                           MESSAGE                           │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Vérifie  │ 39   │ Call to deprecated method checkPlain() of class             │
│ r        │      │ Drupal\Component\Utility\SafeMarkup: Will be removed before │
│ manuelle │      │ Drupal 9.0.0. Rely on Twig's auto-escaping feature, or use  │
│ ment     │      │ the @link theme_render #plain_text @endlink key when        │
│          │      │ constructing a render array that contains plain text in     │
│          │      │ order to use the renderer's auto-escaping feature. If       │
│          │      │ neither of these are possible,                              │
│          │      │ \Drupal\Component\Utility\Html::escape() can be used in     │
│          │      │ places where explicit escaping is needed.                   │
│          │      │                                                             │
│ Vérifie  │ 39   │ Call to method checkPlain() of deprecated class             │
│ r        │      │ Drupal\Component\Utility\SafeMarkup: Will be removed before │
│ manuelle │      │ Drupal 9.0.0. Use the appropriate                           │
│ ment     │      │                                                             │
│ Vérifie  │ 43   │ Call to deprecated method checkPlain() of class             │
│ r        │      │ Drupal\Component\Utility\SafeMarkup: Will be removed before │
│ manuelle │      │ Drupal 9.0.0. Rely on Twig's auto-escaping feature, or use  │
│ ment     │      │ the @link theme_render #plain_text @endlink key when        │
│          │      │ constructing a render array that contains plain text in     │
│          │      │ order to use the renderer's auto-escaping feature. If       │
│          │      │ neither of these are possible,                              │
│          │      │ \Drupal\Component\Utility\Html::escape() can be used in     │
│          │      │ places where explicit escaping is needed.                   │
│          │      │                                                             │
│ Vérifie  │ 43   │ Call to method checkPlain() of deprecated class             │
│ r        │      │ Drupal\Component\Utility\SafeMarkup: Will be removed before │
│ manuelle │      │ Drupal 9.0.0. Use the appropriate                           │
│ ment     │      │                                                             │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘

Proposed resolution

Applying this patch to use the new recommended methos seems to work

CommentFileSizeAuthor
mobile_detect.patch740 bytesla vague illuminee

Comments

gaveline created an issue. See original summary.

la vague illuminee’s picture

Title: Drupal 9 deprecated "" » Drupal 9 deprecated "SafeMarkup::checkPlain()"
nonom’s picture

Assigned: Unassigned » nonom
nonom’s picture

Since it's deprecated we should remove it. Thanks for the patch. It's working for me.

nonom’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.