bug #12555 [Debug] fix ENT_SUBSTITUTE usage (nicolas-grekas)

This PR was merged into the 2.6 branch.

Discussion
----------

[Debug] fix ENT_SUBSTITUTE usage

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

58476e1 [Debug] fix ENT_SUBSTITUTE usage
This commit is contained in:
Fabien Potencier 2014-11-23 21:33:43 +01:00
commit 7fd45f7d08

View File

@ -384,11 +384,6 @@ EOF;
*/
private function formatArgs(array $args)
{
if (PHP_VERSION_ID >= 50400) {
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
} else {
$flags = ENT_QUOTES;
}
$result = array();
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
@ -429,7 +424,7 @@ EOF;
$str = iconv($charset, 'UTF-8', $str);
}
return htmlspecialchars($str, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
}
/**