Skip to content
This repository
Browse code

Merge branch '2.2'

* 2.2:
  Defined stable version point of Doctrine.
  [HttpFoundation] Remove Cache-Control when using https download via IE<9 (fixes #6750)
  Update composer.json
  [Form] Fixed TimeType not to render a "size" attribute in select tags
  [Form] Added test for "label" option to accept the value "0"
  Expanded fault-tolerance for unusual cookie dates
  Fix docblock type
  [Form] Fixed "label" option to accept the value "0"
  Added greek translation
  merged branch jfcixmedia/2.1 (PR #5838)
  added a note about a BC break for the path info of sub-request (closes #7138)
  [DomCrawler] lowered parsed protocol string (fixes #6986)
  [FrameworkBundle] Fix a BC for Hinclude global template
  [HttpKernel] fixed locale management when exiting sub-requests
  fixed HInclude renderer (closes #7113)
  Removed some leaking deprecation warning in the Form component
  [HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/composer.json
	src/Symfony/Component/Security/composer.json
  • Loading branch information...
commit fb7004baab20d1c861c47545b2ba7bccfc830e18 2 parents 1c783f6 + 825dc17
Fabien Potencier fabpot authored

Showing 25 changed files with 238 additions and 55 deletions. Show diff stats Hide diff stats

  1. +21 21 src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
  2. +1 1  src/Symfony/Bridge/Twig/Extension/FormExtension.php
  3. +2 1  src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
  4. +1 1  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
  5. +3 1 src/Symfony/Bundle/FrameworkBundle/Fragment/ContainerAwareHIncludeFragmentRenderer.php
  6. +4 3 src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php
  7. +30 0 src/Symfony/Bundle/FrameworkBundle/Tests/Fragments/ContainerAwareHIncludeFragmentRendererTest.php
  8. +1 1  src/Symfony/Bundle/FrameworkBundle/composer.json
  9. +7 0 src/Symfony/Component/BrowserKit/Cookie.php
  10. +4 1 src/Symfony/Component/BrowserKit/Tests/CookieTest.php
  11. +1 1  src/Symfony/Component/DomCrawler/Link.php
  12. +2 0  src/Symfony/Component/Form/ResolvedFormType.php
  13. +19 0 src/Symfony/Component/Form/Resources/translations/validators.el.xlf
  14. +6 5 src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
  15. +13 0 src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
  16. +2 2 src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
  17. +1 1  src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
  18. +0 7 src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php
  19. +10 0 src/Symfony/Component/HttpFoundation/Response.php
  20. +69 0 src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
  21. +1 0  src/Symfony/Component/HttpKernel/CHANGELOG.md
  22. +25 7 src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
  23. +13 0 src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
  24. +1 1  src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
  25. +1 1  src/Symfony/Component/Security/composer.json
42 src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -209,7 +209,7 @@ public function testSetDataSingleNull()
209 209 $field->setData(null);
210 210
211 211 $this->assertNull($field->getData());
212   - $this->assertSame('', $field->getClientData());
  212 + $this->assertSame('', $field->getViewData());
213 213 }
214 214
215 215 public function testSetDataMultipleExpandedNull()
@@ -223,7 +223,7 @@ public function testSetDataMultipleExpandedNull()
223 223 $field->setData(null);
224 224
225 225 $this->assertNull($field->getData());
226   - $this->assertSame(array(), $field->getClientData());
  226 + $this->assertSame(array(), $field->getViewData());
227 227 }
228 228
229 229 public function testSetDataMultipleNonExpandedNull()
@@ -237,7 +237,7 @@ public function testSetDataMultipleNonExpandedNull()
237 237 $field->setData(null);
238 238
239 239 $this->assertNull($field->getData());
240   - $this->assertSame(array(), $field->getClientData());
  240 + $this->assertSame(array(), $field->getViewData());
241 241 }
242 242
243 243 public function testSubmitSingleExpandedNull()
@@ -251,7 +251,7 @@ public function testSubmitSingleExpandedNull()
251 251 $field->bind(null);
252 252
253 253 $this->assertNull($field->getData());
254   - $this->assertSame(array(), $field->getClientData());
  254 + $this->assertSame(array(), $field->getViewData());
255 255 }
256 256
257 257 public function testSubmitSingleNonExpandedNull()
@@ -265,7 +265,7 @@ public function testSubmitSingleNonExpandedNull()
265 265 $field->bind(null);
266 266
267 267 $this->assertNull($field->getData());
268   - $this->assertSame('', $field->getClientData());
  268 + $this->assertSame('', $field->getViewData());
269 269 }
270 270
271 271 public function testSubmitMultipleNull()
@@ -278,7 +278,7 @@ public function testSubmitMultipleNull()
278 278 $field->bind(null);
279 279
280 280 $this->assertEquals(new ArrayCollection(), $field->getData());
281   - $this->assertSame(array(), $field->getClientData());
  281 + $this->assertSame(array(), $field->getViewData());
282 282 }
283 283
284 284 public function testSubmitSingleNonExpandedSingleIdentifier()
@@ -300,7 +300,7 @@ public function testSubmitSingleNonExpandedSingleIdentifier()
300 300
301 301 $this->assertTrue($field->isSynchronized());
302 302 $this->assertSame($entity2, $field->getData());
303   - $this->assertSame('2', $field->getClientData());
  303 + $this->assertSame('2', $field->getViewData());
304 304 }
305 305
306 306 public function testSubmitSingleNonExpandedCompositeIdentifier()
@@ -323,7 +323,7 @@ public function testSubmitSingleNonExpandedCompositeIdentifier()
323 323
324 324 $this->assertTrue($field->isSynchronized());
325 325 $this->assertSame($entity2, $field->getData());
326   - $this->assertSame('1', $field->getClientData());
  326 + $this->assertSame('1', $field->getViewData());
327 327 }
328 328
329 329 public function testSubmitMultipleNonExpandedSingleIdentifier()
@@ -348,7 +348,7 @@ public function testSubmitMultipleNonExpandedSingleIdentifier()
348 348
349 349 $this->assertTrue($field->isSynchronized());
350 350 $this->assertEquals($expected, $field->getData());
351   - $this->assertSame(array('1', '3'), $field->getClientData());
  351 + $this->assertSame(array('1', '3'), $field->getViewData());
352 352 }
353 353
354 354 public function testSubmitMultipleNonExpandedSingleIdentifierForExistingData()
@@ -379,7 +379,7 @@ public function testSubmitMultipleNonExpandedSingleIdentifierForExistingData()
379 379 $this->assertEquals($expected, $field->getData());
380 380 // same object still, useful if it is a PersistentCollection
381 381 $this->assertSame($existing, $field->getData());
382   - $this->assertSame(array('1', '3'), $field->getClientData());
  382 + $this->assertSame(array('1', '3'), $field->getViewData());
383 383 }
384 384
385 385 public function testSubmitMultipleNonExpandedCompositeIdentifier()
@@ -405,7 +405,7 @@ public function testSubmitMultipleNonExpandedCompositeIdentifier()
405 405
406 406 $this->assertTrue($field->isSynchronized());
407 407 $this->assertEquals($expected, $field->getData());
408   - $this->assertSame(array('0', '2'), $field->getClientData());
  408 + $this->assertSame(array('0', '2'), $field->getViewData());
409 409 }
410 410
411 411 public function testSubmitMultipleNonExpandedCompositeIdentifierExistingData()
@@ -436,7 +436,7 @@ public function testSubmitMultipleNonExpandedCompositeIdentifierExistingData()
436 436 $this->assertEquals($expected, $field->getData());
437 437 // same object still, useful if it is a PersistentCollection
438 438 $this->assertSame($existing, $field->getData());
439   - $this->assertSame(array('0', '2'), $field->getClientData());
  439 + $this->assertSame(array('0', '2'), $field->getViewData());
440 440 }
441 441
442 442 public function testSubmitSingleExpanded()
@@ -460,8 +460,8 @@ public function testSubmitSingleExpanded()
460 460 $this->assertSame($entity2, $field->getData());
461 461 $this->assertFalse($field['1']->getData());
462 462 $this->assertTrue($field['2']->getData());
463   - $this->assertNull($field['1']->getClientData());
464   - $this->assertSame('2', $field['2']->getClientData());
  463 + $this->assertNull($field['1']->getViewData());
  464 + $this->assertSame('2', $field['2']->getViewData());
465 465 }
466 466
467 467 public function testSubmitMultipleExpanded()
@@ -489,9 +489,9 @@ public function testSubmitMultipleExpanded()
489 489 $this->assertTrue($field['1']->getData());
490 490 $this->assertFalse($field['2']->getData());
491 491 $this->assertTrue($field['3']->getData());
492   - $this->assertSame('1', $field['1']->getClientData());
493   - $this->assertNull($field['2']->getClientData());
494   - $this->assertSame('3', $field['3']->getClientData());
  492 + $this->assertSame('1', $field['1']->getViewData());
  493 + $this->assertNull($field['2']->getViewData());
  494 + $this->assertSame('3', $field['3']->getViewData());
495 495 }
496 496
497 497 public function testOverrideChoices()
@@ -515,7 +515,7 @@ public function testOverrideChoices()
515 515 $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
516 516 $this->assertTrue($field->isSynchronized());
517 517 $this->assertSame($entity2, $field->getData());
518   - $this->assertSame('2', $field->getClientData());
  518 + $this->assertSame('2', $field->getViewData());
519 519 }
520 520
521 521 public function testGroupByChoices()
@@ -537,7 +537,7 @@ public function testGroupByChoices()
537 537
538 538 $field->bind('2');
539 539
540   - $this->assertSame('2', $field->getClientData());
  540 + $this->assertSame('2', $field->getViewData());
541 541 $this->assertEquals(array(
542 542 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')),
543 543 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')),
@@ -716,7 +716,7 @@ public function testSubmitSingleStringIdentifier()
716 716
717 717 $this->assertTrue($field->isSynchronized());
718 718 $this->assertSame($entity1, $field->getData());
719   - $this->assertSame('foo', $field->getClientData());
  719 + $this->assertSame('foo', $field->getViewData());
720 720 }
721 721
722 722 public function testSubmitCompositeStringIdentifier()
@@ -738,7 +738,7 @@ public function testSubmitCompositeStringIdentifier()
738 738
739 739 $this->assertTrue($field->isSynchronized());
740 740 $this->assertSame($entity1, $field->getData());
741   - $this->assertSame('0', $field->getClientData());
  741 + $this->assertSame('0', $field->getViewData());
742 742 }
743 743
744 744 public function testGetManagerForClassIfNoEm()
2  src/Symfony/Bridge/Twig/Extension/FormExtension.php
@@ -27,7 +27,7 @@ class FormExtension extends \Twig_Extension
27 27 * This property is public so that it can be accessed directly from compiled
28 28 * templates without having to call a getter, which slightly decreases performance.
29 29 *
30   - * @var \Symfony\Component\Form\FormRendererInterface
  30 + * @var TwigRendererInterface
31 31 */
32 32 public $renderer;
33 33
3  src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -147,8 +147,9 @@
147 147 {% if widget == 'single_text' %}
148 148 {{ block('form_widget_simple') }}
149 149 {% else %}
  150 + {% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
150 151 <div {{ block('widget_container_attributes') }}>
151   - {{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}{% if with_minutes %}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
  152 + {{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
152 153 </div>
153 154 {% endif %}
154 155 {% endspaceless %}
2  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -365,7 +365,7 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB
365 365
366 366 $container->setParameter('templating.helper.code.file_link_format', isset($links[$ide]) ? $links[$ide] : $ide);
367 367 $container->setParameter('templating.helper.form.resources', $config['form']['resources']);
368   - $container->setParameter('templating.hinclude.default_template', $config['hinclude_default_template']);
  368 + $container->setParameter('fragment.renderer.hinclude.global_template', $config['hinclude_default_template']);
369 369
370 370 if ($container->getParameter('kernel.debug')) {
371 371 $loader->load('templating_debug.xml');
4 src/Symfony/Bundle/FrameworkBundle/Fragment/ContainerAwareHIncludeFragmentRenderer.php
@@ -40,7 +40,9 @@ public function __construct(ContainerInterface $container, UriSigner $signer = n
40 40 */
41 41 public function render($uri, Request $request, array $options = array())
42 42 {
43   - if (!$this->templating) {
  43 + // setting the templating cannot be done in the constructor
  44 + // as it would lead to an infinite recursion in the service container
  45 + if (!$this->hasTemplating()) {
44 46 $this->setTemplating($this->container->get('templating'));
45 47 }
46 48
7 src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php
... ... @@ -1,20 +1,21 @@
1 1 <?php if ($widget == 'single_text'): ?>
2 2 <?php echo $view['form']->block($form, 'form_widget_simple'); ?>
3 3 <?php else: ?>
  4 + <?php $vars = $widget == 'text' ? array('attr' => array('size' => 1)) : array() ?>
4 5 <div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
5 6 <?php
6 7 // There should be no spaces between the colons and the widgets, that's why
7 8 // this block is written in a single PHP tag
8   - echo $view['form']->widget($form['hour'], array('attr' => array('size' => 1)));
  9 + echo $view['form']->widget($form['hour'], $vars);
9 10
10 11 if ($with_minutes) {
11 12 echo ':';
12   - echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
  13 + echo $view['form']->widget($form['minute'], $vars);
13 14 }
14 15
15 16 if ($with_seconds) {
16 17 echo ':';
17   - echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
  18 + echo $view['form']->widget($form['second'], $vars);
18 19 }
19 20 ?>
20 21 </div>
30 src/Symfony/Bundle/FrameworkBundle/Tests/Fragments/ContainerAwareHIncludeFragmentRendererTest.php
... ... @@ -0,0 +1,30 @@
  1 +<?php
  2 +
  3 +/*
  4 + * This file is part of the Symfony package.
  5 + *
  6 + * (c) Fabien Potencier <fabien@symfony.com>
  7 + *
  8 + * For the full copyright and license information, please view the LICENSE
  9 + * file that was distributed with this source code.
  10 + */
  11 +
  12 +namespace Symfony\Bundle\FrameworkBundle\Tests\Fragment;
  13 +
  14 +use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
  15 +use Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer;
  16 +use Symfony\Component\HttpFoundation\Request;
  17 +
  18 +class ContainerAwareHIncludeFragmentRendererTest extends TestCase
  19 +{
  20 + public function testRender()
  21 + {
  22 + $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
  23 + $container->expects($this->once())
  24 + ->method('get')
  25 + ->will($this->returnValue($this->getMock('\Twig_Environment')))
  26 + ;
  27 + $renderer = new ContainerAwareHIncludeFragmentRenderer($container);
  28 + $renderer->render('/', Request::create('/'));
  29 + }
  30 +}
2  src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -26,7 +26,7 @@
26 26 "symfony/stopwatch": ">=2.2,<2.4-dev",
27 27 "symfony/templating": "~2.1",
28 28 "symfony/translation": ">=2.2,<2.4-dev",
29   - "doctrine/common": ">=2.2,<2.4-dev"
  29 + "doctrine/common": "~2.2"
30 30 },
31 31 "require-dev": {
32 32 "symfony/finder": "~2.0",
7 src/Symfony/Component/BrowserKit/Cookie.php
@@ -30,6 +30,8 @@ class Cookie
@@ -205,6 +207,11 @@ private static function parseDate($dateValue)
5 src/Symfony/Component/BrowserKit/Tests/CookieTest.php
@@ -56,9 +56,12 @@ public function getExpireCookieStrings()
56 56 return array(
57 57 array('foo=bar; expires=Fri, 31-Jul-2020 08:49:37 GMT'),
58 58 array('foo=bar; expires=Fri, 31 Jul 2020 08:49:37 GMT'),
  59 + array('foo=bar; expires=Fri, 31-07-2020 08:49:37 GMT'),
  60 + array('foo=bar; expires=Fri, 31-07-20 08:49:37 GMT'),
59 61 array('foo=bar; expires=Friday, 31-Jul-20 08:49:37 GMT'),
60 62 array('foo=bar; expires=Fri Jul 31 08:49:37 2020'),
61 63 array('foo=bar; expires=\'Fri Jul 31 08:49:37 2020\''),
  64 + array('foo=bar; expires=Friday July 31st 2020, 08:49:37 GMT'),
62 65 );
63 66 }
64 67
@@ -86,7 +89,7 @@ public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
86 89 public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
87 90 {
88 91 $this->setExpectedException('InvalidArgumentException');
89   - Cookie::FromString('foo=bar; expires=foo');
  92 + Cookie::FromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
90 93 }
91 94
92 95 public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
2  src/Symfony/Component/DomCrawler/Link.php
@@ -46,7 +46,7 @@ class Link
2  src/Symfony/Component/Form/ResolvedFormType.php
@@ -62,7 +62,9 @@ public function __construct(FormTypeInterface $innerType, array $typeExtensions
62 62 // BC
63 63 if ($innerType instanceof AbstractType) {
64 64 /* @var AbstractType $innerType */
  65 + set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
65 66 $innerType->setExtensions($typeExtensions);
  67 + restore_error_handler();
66 68 }
67 69
68 70 $this->innerType = $innerType;
19 src/Symfony/Component/Form/Resources/translations/validators.el.xlf
... ... @@ -0,0 +1,19 @@
  1 +<?xml version="1.0"?>
  2 +<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  3 + <file source-language="en" datatype="plaintext" original="file.ext">
  4 + <body>
  5 + <trans-unit id="28">
  6 + <source>This form should not contain extra fields.</source>
  7 + <target>Αυτή η φόρμα δεν πρέπει να περιέχει επιπλέον πεδία.</target>
  8 + </trans-unit>
  9 + <trans-unit id="29">
  10 + <source>The uploaded file was too large. Please try to upload a smaller file.</source>
  11 + <target>Το αρχείο είναι πολύ μεγάλο. Παρακαλούμε προσπαθήστε να ανεβάσετε ένα μικρότερο αρχείο.</target>
  12 + </trans-unit>
  13 + <trans-unit id="30">
  14 + <source>The CSRF token is invalid. Please try to resubmit the form.</source>
  15 + <target>Το CSRF token δεν είναι έγκυρο. Παρακαλούμε δοκιμάστε να υποβάλετε τη φόρμα ξανά.</target>
  16 + </trans-unit>
  17 + </body>
  18 + </file>
  19 +</xliff>
11 src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -1533,11 +1533,11 @@ public function testTime()
1533 1533 [
1534 1534 ./select
1535 1535 [@id="name_hour"]
1536   - [@size="1"]
  1536 + [not(@size)]
1537 1537 [./option[@value="4"][@selected="selected"]]
1538 1538 /following-sibling::select
1539 1539 [@id="name_minute"]
1540   - [@size="1"]
  1540 + [not(@size)]
1541 1541 [./option[@value="5"][@selected="selected"]]
1542 1542 ]
1543 1543 [count(./select)=2]
@@ -1557,17 +1557,17 @@ public function testTimeWithSeconds()
1557 1557 [
1558 1558 ./select
1559 1559 [@id="name_hour"]
1560   - [@size="1"]
  1560 + [not(@size)]
1561 1561 [./option[@value="4"][@selected="selected"]]
1562 1562 [count(./option)>23]
1563 1563 /following-sibling::select
1564 1564 [@id="name_minute"]
1565   - [@size="1"]
  1565 + [not(@size)]
1566 1566 [./option[@value="5"][@selected="selected"]]
1567 1567 [count(./option)>59]
1568 1568 /following-sibling::select
1569 1569 [@id="name_second"]
1570   - [@size="1"]
  1570 + [not(@size)]
1571 1571 [./option[@value="6"][@selected="selected"]]
1572 1572 [count(./option)>59]
1573 1573 ]
@@ -1618,6 +1618,7 @@ public function testTimeSingleText()
1618 1618 [@type="time"]
1619 1619 [@name="name"]
1620 1620 [@value="04:05"]
  1621 + [not(@size)]
1621 1622 '
1622 1623 );
1623 1624 }
13 src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -601,9 +601,11 @@ public function testPropertyPathNullImpliesDefault()
601 601 // BC
602 602 public function testPropertyPathFalseImpliesDefaultNotMapped()
603 603 {
  604 + set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
604 605 $form = $this->factory->createNamed('name', 'form', null, array(
605 606 'property_path' => false,
606 607 ));
  608 + restore_error_handler();
607 609
608 610 $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
609 611 $this->assertFalse($form->getConfig()->getMapped());
@@ -661,4 +663,15 @@ public function testNormDataIsPassedToView()
661 663 $this->assertSame('foo', $view->vars['data']);
662 664 $this->assertSame('bar', $view->vars['value']);
663 665 }
  666 +
  667 + // https://github.com/symfony/symfony/issues/6862
  668 + public function testPassZeroLabelToView()
  669 + {
  670 + $view = $this->factory->create('form', null, array(
  671 + 'label' => '0'
  672 + ))
  673 + ->createView();
  674 +
  675 + $this->assertSame('0', $view->vars['label']);
  676 + }
664 677 }
4 src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
@@ -42,7 +42,7 @@ public function testPassDifferentPatternsForDifferentCurrencies()
42 42 $view1 = $form1->createView();
43 43 $view2 = $form2->createView();
44 44
45   - $this->assertSame('{{ widget }} £', $view1->get('money_pattern'));
46   - $this->assertSame('{{ widget }} €', $view2->get('money_pattern'));
  45 + $this->assertSame('{{ widget }} £', $view1->vars['money_pattern']);
  46 + $this->assertSame('{{ widget }} €', $view2->vars['money_pattern']);
47 47 }
48 48 }
2  src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
@@ -231,7 +231,7 @@ public function testSetDataWithoutMinutes()
231 231
232 232 $form->setData(new \DateTime('03:04:05 UTC'));
233 233
234   - $this->assertEquals(array('hour' => 3), $form->getClientData());
  234 + $this->assertEquals(array('hour' => 3), $form->getViewData());
235 235 }
236 236
237 237 public function testSetDataWithSeconds()
7 src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php
@@ -32,13 +32,6 @@ protected function setUp()
32 32 $this->factory = Forms::createFormFactoryBuilder()
33 33 ->addExtensions($this->getExtensions())
34 34 ->getFormFactory();
35   -
36   - set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
37   - }
38   -
39   - protected function tearDown()
40   - {
41   - restore_error_handler();
42 35 }
43 36
44 37 protected function getExtensions()
10 src/Symfony/Component/HttpFoundation/Response.php
@@ -253,6 +253,16 @@ public function prepare(Request $request)
253 253 $this->headers->set('expires', -1);
254 254 }
255 255
  256 + /**
  257 + * Check if we need to remove Cache-Control for ssl encrypted downloads when using IE < 9
  258 + * @link http://support.microsoft.com/kb/323308
  259 + */
  260 + if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) {
  261 + if(intval(preg_replace("/(MSIE )(.*?);/", "$2", $match[0])) < 9) {
  262 + $this->headers->remove('Cache-Control');
  263 + }
  264 + }
  265 +
256 266 return $this;
257 267 }
258 268
69 src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
@@ -326,6 +326,75 @@ public function testContentTypeCharset()
326 326 $this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
327 327 }
328 328
  329 + public function testNoCacheControlHeaderOnAttachmentUsingHTTPSAndMSIE()
  330 + {
  331 + // Check for HTTPS and IE 8
  332 + $request = new Request();
  333 + $request->server->set('HTTPS', true);
  334 + $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
  335 +
  336 + $response = new Response();
  337 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  338 + $response->prepare($request);
  339 +
  340 + $this->assertFalse($response->headers->has('Cache-Control'));
  341 +
  342 + // Check for IE 10 and HTTPS
  343 + $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)');
  344 +
  345 + $response = new Response();
  346 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  347 + $response->prepare($request);
  348 +
  349 + $this->assertTrue($response->headers->has('Cache-Control'));
  350 +
  351 + // Check for IE 9 and HTTPS
  352 + $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)');
  353 +
  354 + $response = new Response();
  355 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  356 + $response->prepare($request);
  357 +
  358 + $this->assertTrue($response->headers->has('Cache-Control'));
  359 +
  360 + // Check for IE 9 and HTTP
  361 + $request->server->set('HTTPS', false);
  362 +
  363 + $response = new Response();
  364 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  365 + $response->prepare($request);
  366 +
  367 + $this->assertTrue($response->headers->has('Cache-Control'));
  368 +
  369 + // Check for IE 8 and HTTP
  370 + $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
  371 +
  372 + $response = new Response();
  373 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  374 + $response->prepare($request);
  375 +
  376 + $this->assertTrue($response->headers->has('Cache-Control'));
  377 +
  378 + // Check for non-IE and HTTPS
  379 + $request->server->set('HTTPS', true);
  380 + $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17');
  381 +
  382 + $response = new Response();
  383 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  384 + $response->prepare($request);
  385 +
  386 + $this->assertTrue($response->headers->has('Cache-Control'));
  387 +
  388 + // Check for non-IE and HTTP
  389 + $request->server->set('HTTPS', false);
  390 +
  391 + $response = new Response();
  392 + $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
  393 + $response->prepare($request);
  394 +
  395 + $this->assertTrue($response->headers->has('Cache-Control'));
  396 + }
  397 +
329 398 public function testPrepareDoesNothingIfContentTypeIsSet()
330 399 {
331 400 $response = new Response('foo');
1  src/Symfony/Component/HttpKernel/CHANGELOG.md
Source Rendered
@@ -4,6 +4,7 @@ CHANGELOG
4 4 2.2.0
5 5 -----
6 6
  7 + * [BC BREAK] the path info for sub-request is now always _fragment (or whatever you configured instead of the default)
7 8 * added Symfony\Component\HttpKernel\EventListener\FragmentListener
8 9 * added Symfony\Component\HttpKernel\UriSigner
9 10 * added Symfony\Component\HttpKernel\FragmentRenderer and rendering strategies (in Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface)
32 src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
@@ -12,7 +12,9 @@
12 12 namespace Symfony\Component\HttpKernel\EventListener;
13 13
14 14 use Symfony\Component\HttpKernel\Event\GetResponseEvent;
  15 +use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
15 16 use Symfony\Component\HttpKernel\KernelEvents;
  17 +use Symfony\Component\HttpFoundation\Request;
16 18 use Symfony\Component\Routing\RequestContextAwareInterface;
17 19 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
18 20
@@ -25,6 +27,7 @@ class LocaleListener implements EventSubscriberInterface
25 27 {
26 28 private $router;
27 29 private $defaultLocale;
  30 + private $locales = array();
28 31
29 32 public function __construct($defaultLocale = 'en', RequestContextAwareInterface $router = null)
30 33 {
@@ -32,19 +35,24 @@ public function __construct($defaultLocale = 'en', RequestContextAwareInterface
32 35 $this->router = $router;
33 36 }
34 37
  38 + public function onKernelResponse(FilterResponseEvent $event)
  39 + {
  40 + array_shift($this->locales);
  41 +
  42 + // setting back the locale to the previous value
  43 + $locale = isset($this->locales[0]) ? $this->locales[0] : $this->defaultLocale;
  44 + $request = $event->getRequest();
  45 + $this->setLocale($request, $locale);
  46 + }
  47 +
35 48 public function onKernelRequest(GetResponseEvent $event)
36 49 {
37 50 $request = $event->getRequest();
38 51
39 52 $request->setDefaultLocale($this->defaultLocale);
  53 + $this->setLocale($request, $request->attributes->get('_locale', $this->defaultLocale));
40 54
41   - if ($locale = $request->attributes->get('_locale')) {
42   - $request->setLocale($locale);
43   - }
44   -
45   - if (null !== $this->router) {
46   - $this->router->getContext()->setParameter('_locale', $request->getLocale());
47   - }
  55 + array_unshift($this->locales, $request->getLocale());
48 56 }
49 57
50 58 public static function getSubscribedEvents()
@@ -52,6 +60,16 @@ public static function getSubscribedEvents()
52 60 return array(
53 61 // must be registered after the Router to have access to the _locale
54 62 KernelEvents::REQUEST => array(array('onKernelRequest', 16)),
  63 + KernelEvents::RESPONSE => 'onKernelResponse',
55 64 );
56 65 }
  66 +
  67 + private function setLocale(Request $request, $locale)
  68 + {
  69 + $request->setLocale($locale);
  70 +
  71 + if (null !== $this->router) {
  72 + $this->router->getContext()->setParameter('_locale', $request->getLocale());
  73 + }
  74 + }
57 75 }
13 src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
@@ -57,6 +57,16 @@ public function setTemplating($templating)
57 57 }
58 58
59 59 /**
  60 + * Checks if a templating engine has been set.
  61 + *
  62 + * @return Boolean true if the templating engine has been set, false otherwise
  63 + */
  64 + public function hasTemplating()
  65 + {
  66 + return null !== $this->templating;
  67 + }
  68 +
  69 + /**
60 70 * {@inheritdoc}
61 71 *
62 72 * Additional available options:
@@ -73,6 +83,9 @@ public function render($uri, Request $request, array $options = array())
73 83 $uri = $this->signer->sign($this->generateFragmentUri($uri, $request));
74 84 }
75 85
  86 + // We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
  87 + $uri = str_replace('&', '&amp;', $uri);
  88 +
76 89 $template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
77 90 if (null !== $this->templating && $template && $this->templateExists($template)) {
78 91 $content = $this->templating->render($template);
2  src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php
@@ -38,7 +38,7 @@ public function testRenderWithControllerAndSigner()
38 38 {
39 39 $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo'));
40 40
41   - $this->assertEquals('<hx:include src="http://localhost/_fragment?_path=_format%3Dhtml%26_controller%3Dmain_controller&_hash=VI25qJj8J0qveB3bGKPhsJtexKg%3D"></hx:include>', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent());
  41 + $this->assertEquals('<hx:include src="http://localhost/_fragment?_path=_format%3Dhtml%26_controller%3Dmain_controller&amp;_hash=VI25qJj8J0qveB3bGKPhsJtexKg%3D"></hx:include>', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent());
42 42 }
43 43
44 44 public function testRenderWithUri()
2  src/Symfony/Component/Security/composer.json
@@ -25,7 +25,7 @@
25 25 "symfony/form": "~2.0",
26 26 "symfony/routing": ">=2.2,<2.4-dev",
27 27 "symfony/validator": ">=2.2,<2.4-dev",
28   - "doctrine/common": ">=2.2,<2.4-dev",
  28 + "doctrine/common": "~2.2",
29 29 "doctrine/dbal": "~2.2",
30 30 "psr/log": "~1.0"
31 31 },

0 comments on commit fb7004b

Please sign in to comment.
Something went wrong with that request. Please try again.