From bcc0741b67e83ad5a5da49e145fb3035b435584e Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Mon, 25 Oct 2010 00:06:19 +0000
Subject: [PATCH] - Patch #951486 by Damien Tournoud: invalid placeholders in
 exception messages during update.

---
 includes/bootstrap.inc                      | 3 ++-
 includes/update.inc                         | 3 ++-
 modules/simpletest/drupal_web_test_case.php | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 6a9d3a071f62..6f695814adfb 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -1561,7 +1561,8 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia
 
    // Use a default value if $message is not set.
    if (empty($message)) {
-     $message = '%type: %message in %function (line %line of %file).';
+     // The exception message is run through check_plain() by _drupal_decode_exception().
+     $message = '%type: !message in %function (line %line of %file).';
    }
    // $variables must be an array so that we can add the exception information.
    if (!is_array($variables)) {
diff --git a/includes/update.inc b/includes/update.inc
index d1993e0c3ced..d2ba9c1a6fa9 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -883,7 +883,8 @@ function update_do_one($module, $number, $dependency_map, &$context) {
 
       require_once DRUPAL_ROOT . '/includes/errors.inc';
       $variables = _drupal_decode_exception($e);
-      $ret['#abort'] = array('success' => FALSE, 'query' => t('%type: %message in %function (line %line of %file).', $variables));
+      // The exception message is run through check_plain() by _drupal_decode_exception().
+      $ret['#abort'] = array('success' => FALSE, 'query' => t('%type: !message in %function (line %line of %file).', $variables));
     }
   }
 
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 8b57b174cfca..cb1473ff4db9 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -517,7 +517,8 @@ protected function exceptionHandler($exception) {
       'file' => $exception->getFile(),
     ));
     require_once DRUPAL_ROOT . '/includes/errors.inc';
-    $this->error(t('%type: %message in %function (line %line of %file).', _drupal_decode_exception($exception)), 'Uncaught exception', _drupal_get_last_caller($backtrace));
+    // The exception message is run through check_plain() by _drupal_decode_exception().
+    $this->error(t('%type: !message in %function (line %line of %file).', _drupal_decode_exception($exception)), 'Uncaught exception', _drupal_get_last_caller($backtrace));
   }
 
   /**
-- 
GitLab