Skip to content

Commit bfc2118

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [HttpCache] Unlink tmp file on error Added LB translation for #26327 (Errors sign for people that do not see colors) [TwigBridge] Fix rendering of currency by MoneyType [HttpKernel] DumpDataCollector: do not flush when a dumper is provided
2 parents 67ce553 + 401f543 commit bfc2118

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php echo str_replace('{{ widget }}', $view['form']->block($form, 'form_widget_simple'), $money_pattern) ?>
1+
<?php echo $view['form']->formEncodeCurrency($money_pattern, $view['form']->block($form, 'form_widget_simple')) ?>

Templating/Helper/FormHelper.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,20 @@ public function humanize($text)
260260
{
261261
return $this->renderer->humanize($text);
262262
}
263+
264+
/**
265+
* @internal
266+
*/
267+
public function formEncodeCurrency($text, $widget = '')
268+
{
269+
if ('UTF-8' === $charset = $this->getCharset()) {
270+
$text = htmlspecialchars($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');
271+
} else {
272+
$text = htmlentities($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');
273+
$text = iconv('UTF-8', $charset, $text);
274+
$widget = iconv('UTF-8', $charset, $widget);
275+
}
276+
277+
return str_replace('{{ widget }}', $widget, $text);
278+
}
263279
}

Tests/Templating/Helper/FormHelperDivLayoutTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ public function testStartTagHasActionAttributeWhenActionIsZero()
8585
$this->assertSame('<form name="form" method="get" action="0">', $html);
8686
}
8787

88+
public function testMoneyWidgetInIso()
89+
{
90+
$this->engine->setCharset('ISO-8859-1');
91+
92+
$view = $this->factory
93+
->createNamed('name', 'money')
94+
->createView()
95+
;
96+
97+
$this->assertSame('&euro; <input type="text" id="name" name="name" required="required" />', $this->renderWidget($view));
98+
}
99+
88100
protected function renderForm(FormView $view, array $vars = array())
89101
{
90102
return (string) $this->engine->get('form')->form($view, $vars);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"symfony/security-core": "~2.6.13|~2.7.9|~2.8|~3.0.0",
3333
"symfony/security-csrf": "~2.6|~3.0.0",
3434
"symfony/stopwatch": "~2.3|~3.0.0",
35-
"symfony/templating": "~2.1|~3.0.0",
35+
"symfony/templating": "~2.7|~3.0.0",
3636
"symfony/translation": "~2.8",
3737
"doctrine/cache": "~1.0",
3838
"doctrine/annotations": "~1.0"

0 commit comments

Comments
 (0)