From 3a7ac9759ab8f98eee0bb15db4618fd0ee146ab6 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 29 Nov 2011 10:43:06 +0100 Subject: [PATCH] BUGFIX Consistently using multibyte-safe htmlentities() --- dev/Backtrace.php | 2 +- dev/Debug.php | 2 +- dev/DebugView.php | 2 +- dev/install/install.php5 | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/Backtrace.php b/dev/Backtrace.php index 186641ead..45531f70e 100644 --- a/dev/Backtrace.php +++ b/dev/Backtrace.php @@ -173,7 +173,7 @@ class SS_Backtrace { } $result .= "
  • " . htmlentities($name, ENT_COMPAT, 'UTF-8') . "\n
    \n"; $result .= isset($item['line']) ? "Line $item[line] of " : ''; - $result .= isset($item['file']) ? htmlentities(basename($item['file'])) : ''; + $result .= isset($item['file']) ? htmlentities(basename($item['file']), ENT_COMPAT, 'UTF-8') : ''; $result .= "
  • \n"; } } diff --git a/dev/Debug.php b/dev/Debug.php index f568a8f63..8c30fc9e0 100644 --- a/dev/Debug.php +++ b/dev/Debug.php @@ -141,7 +141,7 @@ class Debug { $val = '(bool) ' . $val; } else { if(!Director::is_cli() && !Director::is_ajax()) { - $val = "
    " . htmlentities($val) . "
    \n"; + $val = "
    " . htmlentities($val, ENT_COMPAT, 'UTF-8') . "
    \n"; } } diff --git a/dev/DebugView.php b/dev/DebugView.php index 9014e3be6..fea85a309 100644 --- a/dev/DebugView.php +++ b/dev/DebugView.php @@ -126,7 +126,7 @@ class DebugView extends Object { */ public function writeError($httpRequest, $errno, $errstr, $errfile, $errline, $errcontext) { $errorType = self::$error_types[$errno]; - $httpRequestEnt = htmlentities($httpRequest); + $httpRequestEnt = htmlentities($httpRequest, ENT_COMPAT, 'UTF-8'); echo '
    '; echo "

    [" . $errorType['title'] . '] ' . strip_tags($errstr) . "

    "; echo "

    $httpRequestEnt

    "; diff --git a/dev/install/install.php5 b/dev/install/install.php5 index bfc21a0c5..48599010e 100644 --- a/dev/install/install.php5 +++ b/dev/install/install.php5 @@ -469,7 +469,7 @@ class InstallRequirements { if($this->errors) { echo "

    The following problems are preventing me from installing SilverStripe CMS:

    \n\n"; foreach($this->errors as $error) { - echo "
  • " . htmlentities(implode(", ", $error)) . "
  • \n"; + echo "
  • " . htmlentities(implode(", ", $error), ENT_COMPAT, 'UTF-8') . "
  • \n"; } } } @@ -480,7 +480,7 @@ class InstallRequirements { $id = strtolower(str_replace(' ', '_', $section)); echo ""; foreach($tests as $test => $result) { - echo ""; + echo ""; } echo "
    $test" . nl2br(htmlentities($result[1])) . "
    $test" . nl2br(htmlentities($result[1]), ENT_COMPAT, 'UTF-8') . "
    "; @@ -502,7 +502,7 @@ class InstallRequirements { break; } } - $output .= "$test" . nl2br(htmlentities($result[1])) . ""; + $output .= "$test" . nl2br(htmlentities($result[1], ENT_COMPAT, 'UTF-8')) . ""; } $className = "good"; $text = "All Requirements Pass";