Skip to content

Commit

Permalink
Do not define ENT_SUBSTITUTE constant if missing
Browse files Browse the repository at this point in the history
It may have side effects on other code.
Also changed the value to 0 to emphasize it is noneffective.
  • Loading branch information
vlakoff committed Jan 13, 2015
1 parent c316544 commit 0a54645
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Template/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,17 @@ protected function batch($var, $functions)
*/
protected function escape($string, $functions = null)
{
static $flags;

if (!isset($flags)) {
$flags = ENT_QUOTES | (defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0);
}

if ($functions) {
$string = $this->batch($string, $functions);
}

return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
return htmlspecialchars($string, $flags, 'UTF-8');
}

/**
Expand All @@ -271,7 +277,3 @@ protected function e($string, $functions = null)
return $this->escape($string, $functions);
}
}

if (!defined('ENT_SUBSTITUTE')) {
define('ENT_SUBSTITUTE', 8);
}

0 comments on commit 0a54645

Please sign in to comment.