diff --git a/lib/Drupal/Component/Utility/Html.php b/lib/Drupal/Component/Utility/Html.php
index 7271519e51..e2bc3e538d 100644
--- a/core/lib/Drupal/Component/Utility/Html.php
+++ b/core/lib/Drupal/Component/Utility/Html.php
@@ -425,11 +425,32 @@ EOD;
    * @ingroup sanitization
    */
   public static function escape($text): string {
-    if (is_null($text)) {
+
+    // Temporary patch to mask TypeError WSOD if Argument in $text is Array instead of text.
+    // See https://www.drupal.org/node/3352384 for more.
+    if (is_array($text)) {
+      @trigger_error('Passing Arguments of Type Array to ' . __METHOD__ . ' will trigger a PHP TypeError in drupal:9.5.0 and higher. Pass a string instead. See https://www.drupal.org/node/3352384', E_USER_DEPRECATED);
+      \Drupal::messenger()->addMessage(t('Passing Arguments of Type Array to ' . __METHOD__ . ' will trigger a PHP TypeError in drupal:9.5.0 and higher. Pass a string instead. See <a href="https://www.drupal.org/node/3352384">Drupal core issue 3352384</a> for more details. Enable var_dump() or Devel dpm() by uncommenting the lines 434-439 from this patch added in \Drupal\Component\Utility\Html.php.'), 'error', FALSE, $uid=0);
+
+      // Enable for debugging only.
+      //
+      // if (\Drupal::moduleHandler()->moduleExists('devel')) {
+      //   dpm($text);
+      // }
+      // else {
+      //   var_dump($text);
+      // }
+
+      // To prevent site being not operatable we suppress TypeError in case of Array by converting into text.
+      return htmlspecialchars((string) $text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
+    }
+    elseif (is_null($text)) {
       @trigger_error('Passing NULL to ' . __METHOD__ . ' is deprecated in drupal:9.5.0 and will trigger a PHP error from drupal:11.0.0. Pass a string instead. See https://www.drupal.org/node/3318826', E_USER_DEPRECATED);
       return '';
     }
-    return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
+    else {
+      return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
+    }
   }

   /**
