8000 Merge branch '2.4' · sandermarechal/symfony@a45e464 · GitHub
[go: up one dir, main page]

Skip to content

Commit a45e464

Browse files
committed
Merge branch '2.4'
* 2.4: Update MimeTypeExtensionGuesser.php [Validator] Add missing polish translations [Validator] Added missing strings from Image validator [Templating] PhpEngine should propagate charset to its helpers Fix ticket symfony#10663 - Added setCharset method call to PHP templating engine. Changed the typehint of the EsiFragmentRenderer to the interface [Form] Improved test coverage of UrlType [BrowserKit] Fix symfony#10641 : BrowserKit is broken when using ip as host
2 parents dbf7eeb + 144b58c commit a45e464

File tree

11 files changed

+99
-7
lines changed

11 files changed

+99
-7
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_debug.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<argument type="service" id="templating.loader" />
1616
<argument type="service" id="debug.stopwatch" />
1717
<argument type="service" id="templating.globals" />
18+
<call method="setCharset"><argument>%kernel.charset%</argument></call>
1819
</service>
1920
</services>
2021
</container>

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function request($method, $uri, array $parameters = array(), array $files
297297
$uri = $this->getAbsoluteUri($uri);
298298

299299
if (isset($server['HTTP_HOST'])) {
300-
$uri = preg_replace('{^(https?\://)'.parse_url($uri, PHP_URL_HOST).'}', '\\1'.$server['HTTP_HOST'], $uri);
300+
$uri = preg_replace('{^(https?\://)'.parse_url($uri, PHP_URL_HOST).'}', '${1}'.$server['HTTP_HOST'], $uri);
301301
}
302302

303303
if (isset($server['HTTPS'])) {

src/Symfony/Component/BrowserKit/Tests/ClientTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ public function testGetRequest()
103103
$this->assertEquals('http://example.com/', $client->getRequest()->getUri(), '->getCrawler() returns the Request of the last request');
104104
}
105105

106+
public function testGetRequestWithIpAsHost()
107+
{
108+
$client = new TestClient();
109+
$client->request('GET', 'https://example.com/foo', array(), array(), array('HTTP_HOST' => '127.0.0.1'));
110+
111+
$this->assertEquals('https://127.0.0.1/foo', $client->getRequest()->getUri());
112+
}
113+
106114
public function testGetResponse()
107115
{
108116
$client = new TestClient();

src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ public function testSubmitAddsNoDefaultProtocolIfEmpty()
4747
$this->assertSame('', $form->getViewData());
4848
}
4949

50+
public function testSubmitAddsNoDefaultProtocolIfNull()
51+
{
52+
$form = $this->factory->create('url', null, array(
53+
'default_protocol' => 'http',
54+
));
55+
56+
$form->submit(null);
57+
58+
$this->assertNull($form->getData());
59+
$this->assertSame('', $form->getViewData());
60+
}
61+
5062
public function testSubmitAddsNoDefaultProtocolIfSetToNull()
5163
{
5264
$form = $this->factory->create('url', null, array(

src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
655655
'chemical/x-csml' => 'csml',
656656
'chemical/x-xyz' => 'xyz',
657657
'image/bmp' => 'bmp',
658+
'image/x-ms-bmp' => 'bmp',
658659
'image/cgm' => 'cgm',
659660
'image/g3fax' => 'g3',
660661
'image/gif' => 'gif',

src/Symfony/Component/HttpKernel/Fragment/EsiFragmentRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class EsiFragmentRenderer extends RoutableFragmentRenderer
3232
* The "fallback" strategy when ESI is not available should always be an
3333
* instance of InlineFragmentRenderer.
3434
*
35-
* @param Esi $esi An Esi instance
36-
* @param InlineFragmentRenderer $inlineStrategy The inline strategy to use when ESI is not supported
35+
* @param Esi $esi An Esi instance
36+
* @param FragmentRendererInterface $inlineStrategy The inline strategy to use when ESI is not supported
3737
*/
3838
public function __construct(Esi $esi = null, InlineFragmentRenderer $inlineStrategy)
3939
{

src/Symfony/Component/Templating/PhpEngine.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class PhpEngine implements EngineInterface, \ArrayAccess
3232
{
3333
protected $loader;
3434
protected $current;
35+
/**
36+
* @var HelperInterface[]
37+
*/
3538
protected $helpers = array();
3639
protected $parents = array();
3740
protected $stack = array();
@@ -364,6 +367,10 @@ public function escape($value, $context = 'html')
364367
public function setCharset($charset)
365368
{
366369
$this->charset = $charset;
370+
371+
foreach ($this->helpers as $helper) {
372+
$helper->setCharset($this->charset);
373+
}
367374
}
368375

369376
/**

src/Symfony/Component/Templating/Tests/PhpEngineTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Templating\PhpEngine;
1515
use Symfony\Component\Templating\Loader\Loader;
16-
use Symfony\Component\Templating\Storage\Storage;
1716
use Symfony\Component\Templating\Storage\StringStorage;
1817
use Symfony\Component\Templating\Helper\SlotsHelper;
1918
use Symfony\Component\Templating\TemplateNameParser;
@@ -152,10 +151,14 @@ public function testEscape()
152151

153152
public function testGetSetCharset()
154153
{
155-
$engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader);
156-
$this->assertEquals('UTF-8', $engine->getCharset(), '->getCharset() returns UTF-8 by default');
154+
$helper = new SlotsHelper();
155+
$engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader, array($helper));
156+
$this->assertEquals('UTF-8', $engine->getCharset(), 'EngineInterface::getCharset() returns UTF-8 by default');
157+
$this->assertEquals('UTF-8', $helper->getCharset(), 'HelperInterface::getCharset() returns UTF-8 by default');
158+
157159
$engine->setCharset('ISO-8859-1');
158-
$this->assertEquals('ISO-8859-1', $engine->getCharset(), '->setCharset() changes the default charset to use');
160+
$this->assertEquals('ISO-8859-1', $engine->getCharset(), 'EngineInterface::setCharset() changes the default charset to use');
161+
$this->assertEquals('ISO-8859-1', $helper->getCharset(), 'EngineInterface::setCharset() changes the default charset of helper');
159162
}
160163

161164
public function testGlobalVariables()

src/Symfony/Component/Validator/Resources/translations/validators.en.xlf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,26 @@
278278
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
279279
<target>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</target>
280280
</trans-unit>
281+
<trans-unit id="73">
282+
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
283+
<target>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</target>
284+
</trans-unit>
285+
<trans-unit id="74">
286+
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
287+
<target>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</target>
288+
</trans-unit>
289+
<trans-unit id="75">
290+
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
291+
<target>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</target>
292+
</trans-unit>
293+
<trans-unit id="76">
294+
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
295+
<target>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</target>
296+
</trans-unit>
297+
<trans-unit id="77">
298+
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
299+
<target>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</target>
300+
</trans-unit>
281301
</body>
282302
</file>
283303
</xliff>

src/Symfony/Component/Validator/Resources/translations/validators.es.xlf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,26 @@
278278
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
279279
<target>Este valor no debería ser idéntico a {{ compared_value_type }} {{ compared_value }}.</target>
280280
</trans-unit>
281+
<trans-unit id="73">
282+
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
283+
<target>La proporción de la imagen es demasiado grande ({{ ratio }}). Maxima proporción permitida es {{ max_ratio }}.</target>
284+
</trans-unit>
285+
<trans-unit id="74">
286+
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
287+
<target>La proporción de la imagen es demasiado pequeña ({{ ratio }}). Mínima proporción permitida es {{ min_ratio }}.</target>
288+
</trans-unit>
289+
<trans-unit id="75">
290+
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
291+
<target>La imagen es cuadrada ({{ width }}x{{ height }}px). Imágenes cuadradas no son permitidas.</target>
292+
</trans-unit>
293+
<trans-unit id="76">
294+
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
295+
<target>La imagen está orientada horizontal ({{ width }}x{{ height }}px). Imágenes orientada horizontal no está permitido.</target>
296+
</trans-unit>
297+
<trans-unit id="77">
298+
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
299+
<target>La imagen está orientada vertical ({{ width }}x{{ height }}px). Imágenes orientada vertical no está permitido.</target>
300+
</trans-unit>
281301
</body>
282302
</file>
283303
</xliff>

src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,26 @@
278278
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
279279
<target>Ta wartość nie powinna być identycznego typu {{ compared_value_type }} oraz wartości {{ compared_value }}.</target>
280280
</trans-unit>
281+
<trans-unit id="73">
282+
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
283+
<target>Proporcje obrazu są zbyt duże ({{ ratio }}). Maksymalne proporcje to {{ max_ratio }}.</target>
284+
</trans-unit>
285+
<trans-unit id="74">
286+
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
287+
<target>Proporcje obrazu są zbyt małe ({{ ratio }}). Minimalne proporcje to {{ min_ratio }}.</target>
288+
</trans-unit>
289+
<trans-unit id="75">
290+
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
291+
<target>Obraz jest kwadratem ({{ width }}x{{ height }}px). Kwadratowe obrazy nie są akceptowane.</target>
292+
</trans-unit>
293+
<trans-unit id="76">
294+
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
295+
<target>Obraz jest panoramiczny ({{ width }}x{{ height }}px). Panoramiczne zdjęcia nie są akceptowane.</target>
296+
</trans-unit>
297+
<trans-unit id="77">
298+
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
299+
<target>Obraz jest portretowy ({{ width }}x{{ height }}px). Portretowe zdjęcia nie są akceptowane.</target>
300+
</trans-unit>
281301
</body>
282302
</file>
283303
</xliff>

0 commit comments

Comments
 (0)
0