Skip to content

Commit 3aa9213

Browse files
committed
don't override internal PHP constants
1 parent 62bda59 commit 3aa9213

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Fragment/HIncludeFragmentRenderer.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Component\HttpKernel\Fragment;
1313

14-
if (!defined('ENT_SUBSTITUTE')) {
15-
define('ENT_SUBSTITUTE', 8);
16-
}
17-
1814
use Symfony\Component\HttpFoundation\Request;
1915
use Symfony\Component\HttpFoundation\Response;
2016
use Symfony\Component\Templating\EngineInterface;
@@ -111,11 +107,16 @@ public function render($uri, Request $request, array $options = array())
111107
}
112108
$renderedAttributes = '';
113109
if (count($attributes) > 0) {
110+
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
111+
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
112+
} else {
113+
$flags = ENT_QUOTES;
114+
}
114115
foreach ($attributes as $attribute => $value) {
115116
$renderedAttributes .= sprintf(
116117
' %s="%s"',
117-
htmlspecialchars($attribute, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset, false),
118-
htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset, false)
118+
htmlspecialchars($attribute, $flags, $this->charset, false),
119+
htmlspecialchars($value, $flags, $this->charset, false)
119120
);
120121
}
121122
}

0 commit comments

Comments
 (0)