SafeMarkup::checkPlain is going to depreciate.

Will be removed before Drupal 9.0.0. Rely on Twig's auto-escaping feature, or use the #plain_text 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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neerajsingh created an issue. See original summary.

neerajsingh’s picture

Assigned: Unassigned » neerajsingh
Status: Active » Needs work
neerajsingh’s picture

Assigned: neerajsingh » Unassigned
Status: Needs work » Needs review
FileSize
5.09 KB

Patched.

klausi’s picture

Status: Needs review » Needs work
+++ b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php
@@ -58,20 +53,20 @@ public function testIsSafe() {
-    $result = SafeMarkup::checkPlain($text);
+    $result = Html::escape($text);

This is the SafeMarkup test, we don't want to change it here since we need to test the method (even if it is deprecated).

The last submitted patch, 3: drupal-2734983.patch, failed testing.

mayurjadhav’s picture

Status: Needs work » Needs review
FileSize
3.5 KB

Reverted deprecated SafeMarkup changes from Test.

catch’s picture

Title: Remove deprecated SafeMarkup::checkPlain from core » Remove deprecated SafeMarkup::checkPlain usages from core
Nikhilesh Gupta’s picture

Attached patch removes all SafeMarkup::checkPlain deprecated usages from core.

Status: Needs review » Needs work

The last submitted patch, 8: drupal8-2734983.patch, failed testing.

Nikhilesh Gupta’s picture

Status: Needs work » Needs review
FileSize
3.28 KB

Status: Needs review » Needs work

The last submitted patch, 10: drupal-2734983.patch, failed testing.

dimaro’s picture

Status: Needs work » Needs review
FileSize
3.3 KB

Rerolled #10.
Simple rebase fixed it.

dimaro’s picture

I checked all the usages of SafeMarkup::checkPlain. All were removed except those in class SafeMarkupTest.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lucur’s picture

Patch works for 8.3.x-dev

lucur’s picture

Status: Needs review » Reviewed & tested by the community

  • catch committed fc4f5cc on 8.3.x
    Issue #2734983 by Nikhilesh Gupta, neerajsingh, dimaro, mayurjadhav:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x, thanks!

Status: Fixed » Closed (fixed)

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