Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor, escape console output after parsing so quotes don't trigger th…

…e "#" comment rule.
  • Loading branch information...
commit c5456f89cbc94effded116940b9a9958e23d69be 1 parent 5711789
@epriestley epriestley authored
View
10 src/markup/syntax/highlighter/console/PhutilConsoleSyntaxHighlighter.php
@@ -34,8 +34,6 @@ public function setConfig($key, $value) {
public function getHighlightFuture($source) {
- $source = phutil_escape_html($source);
-
$lines = explode("\n", $source);
foreach ($lines as $key => $line) {
$matches = null;
@@ -49,15 +47,15 @@ public function getHighlightFuture($source) {
if (preg_match('@^(\S+/ )?([$] .*?)(#.*)?$@', $line, $matches)) {
$line = '';
if ($matches[1]) {
- $line .= $matches[1];
+ $line .= phutil_escape_html($matches[1]);
}
- $line .= '<span class="gp">'.$matches[2].'</span>';
+ $line .= '<span class="gp">'.phutil_escape_html($matches[2]).'</span>';
if ($matches[3]) {
- $line .= '<span class="k">'.$matches[3].'</span>';
+ $line .= '<span class="k">'.phutil_escape_html($matches[3]).'</span>';
}
$lines[$key] = $line;
} else {
- $lines[$key] = '<span class="go">'.$line.'</span>';
+ $lines[$key] = '<span class="go">'.phutil_escape_html($line).'</span>';
}
}
$lines = implode("\n", $lines);
Please sign in to comment.
Something went wrong with that request. Please try again.