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
This commit is contained in:
commit
fb7004baab
@ -209,7 +209,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$field->setData(null);
|
$field->setData(null);
|
||||||
|
|
||||||
$this->assertNull($field->getData());
|
$this->assertNull($field->getData());
|
||||||
$this->assertSame('', $field->getClientData());
|
$this->assertSame('', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetDataMultipleExpandedNull()
|
public function testSetDataMultipleExpandedNull()
|
||||||
@ -223,7 +223,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$field->setData(null);
|
$field->setData(null);
|
||||||
|
|
||||||
$this->assertNull($field->getData());
|
$this->assertNull($field->getData());
|
||||||
$this->assertSame(array(), $field->getClientData());
|
$this->assertSame(array(), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetDataMultipleNonExpandedNull()
|
public function testSetDataMultipleNonExpandedNull()
|
||||||
@ -237,7 +237,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$field->setData(null);
|
$field->setData(null);
|
||||||
|
|
||||||
$this->assertNull($field->getData());
|
$this->assertNull($field->getData());
|
||||||
$this->assertSame(array(), $field->getClientData());
|
$this->assertSame(array(), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitSingleExpandedNull()
|
public function testSubmitSingleExpandedNull()
|
||||||
@ -251,7 +251,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$field->bind(null);
|
$field->bind(null);
|
||||||
|
|
||||||
$this->assertNull($field->getData());
|
$this->assertNull($field->getData());
|
||||||
$this->assertSame(array(), $field->getClientData());
|
$this->assertSame(array(), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitSingleNonExpandedNull()
|
public function testSubmitSingleNonExpandedNull()
|
||||||
@ -265,7 +265,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$field->bind(null);
|
$field->bind(null);
|
||||||
|
|
||||||
$this->assertNull($field->getData());
|
$this->assertNull($field->getData());
|
||||||
$this->assertSame('', $field->getClientData());
|
$this->assertSame('', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitMultipleNull()
|
public function testSubmitMultipleNull()
|
||||||
@ -278,7 +278,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$field->bind(null);
|
$field->bind(null);
|
||||||
|
|
||||||
$this->assertEquals(new ArrayCollection(), $field->getData());
|
$this->assertEquals(new ArrayCollection(), $field->getData());
|
||||||
$this->assertSame(array(), $field->getClientData());
|
$this->assertSame(array(), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitSingleNonExpandedSingleIdentifier()
|
public function testSubmitSingleNonExpandedSingleIdentifier()
|
||||||
@ -300,7 +300,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertSame($entity2, $field->getData());
|
$this->assertSame($entity2, $field->getData());
|
||||||
$this->assertSame('2', $field->getClientData());
|
$this->assertSame('2', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitSingleNonExpandedCompositeIdentifier()
|
public function testSubmitSingleNonExpandedCompositeIdentifier()
|
||||||
@ -323,7 +323,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertSame($entity2, $field->getData());
|
$this->assertSame($entity2, $field->getData());
|
||||||
$this->assertSame('1', $field->getClientData());
|
$this->assertSame('1', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitMultipleNonExpandedSingleIdentifier()
|
public function testSubmitMultipleNonExpandedSingleIdentifier()
|
||||||
@ -348,7 +348,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertEquals($expected, $field->getData());
|
$this->assertEquals($expected, $field->getData());
|
||||||
$this->assertSame(array('1', '3'), $field->getClientData());
|
$this->assertSame(array('1', '3'), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitMultipleNonExpandedSingleIdentifierForExistingData()
|
public function testSubmitMultipleNonExpandedSingleIdentifierForExistingData()
|
||||||
@ -379,7 +379,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$this->assertEquals($expected, $field->getData());
|
$this->assertEquals($expected, $field->getData());
|
||||||
// same object still, useful if it is a PersistentCollection
|
// same object still, useful if it is a PersistentCollection
|
||||||
$this->assertSame($existing, $field->getData());
|
$this->assertSame($existing, $field->getData());
|
||||||
$this->assertSame(array('1', '3'), $field->getClientData());
|
$this->assertSame(array('1', '3'), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitMultipleNonExpandedCompositeIdentifier()
|
public function testSubmitMultipleNonExpandedCompositeIdentifier()
|
||||||
@ -405,7 +405,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertEquals($expected, $field->getData());
|
$this->assertEquals($expected, $field->getData());
|
||||||
$this->assertSame(array('0', '2'), $field->getClientData());
|
$this->assertSame(array('0', '2'), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitMultipleNonExpandedCompositeIdentifierExistingData()
|
public function testSubmitMultipleNonExpandedCompositeIdentifierExistingData()
|
||||||
@ -436,7 +436,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$this->assertEquals($expected, $field->getData());
|
$this->assertEquals($expected, $field->getData());
|
||||||
// same object still, useful if it is a PersistentCollection
|
// same object still, useful if it is a PersistentCollection
|
||||||
$this->assertSame($existing, $field->getData());
|
$this->assertSame($existing, $field->getData());
|
||||||
$this->assertSame(array('0', '2'), $field->getClientData());
|
$this->assertSame(array('0', '2'), $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitSingleExpanded()
|
public function testSubmitSingleExpanded()
|
||||||
@ -460,8 +460,8 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$this->assertSame($entity2, $field->getData());
|
$this->assertSame($entity2, $field->getData());
|
||||||
$this->assertFalse($field['1']->getData());
|
$this->assertFalse($field['1']->getData());
|
||||||
$this->assertTrue($field['2']->getData());
|
$this->assertTrue($field['2']->getData());
|
||||||
$this->assertNull($field['1']->getClientData());
|
$this->assertNull($field['1']->getViewData());
|
||||||
$this->assertSame('2', $field['2']->getClientData());
|
$this->assertSame('2', $field['2']->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitMultipleExpanded()
|
public function testSubmitMultipleExpanded()
|
||||||
@ -489,9 +489,9 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$this->assertTrue($field['1']->getData());
|
$this->assertTrue($field['1']->getData());
|
||||||
$this->assertFalse($field['2']->getData());
|
$this->assertFalse($field['2']->getData());
|
||||||
$this->assertTrue($field['3']->getData());
|
$this->assertTrue($field['3']->getData());
|
||||||
$this->assertSame('1', $field['1']->getClientData());
|
$this->assertSame('1', $field['1']->getViewData());
|
||||||
$this->assertNull($field['2']->getClientData());
|
$this->assertNull($field['2']->getViewData());
|
||||||
$this->assertSame('3', $field['3']->getClientData());
|
$this->assertSame('3', $field['3']->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOverrideChoices()
|
public function testOverrideChoices()
|
||||||
@ -515,7 +515,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
$this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
|
$this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertSame($entity2, $field->getData());
|
$this->assertSame($entity2, $field->getData());
|
||||||
$this->assertSame('2', $field->getClientData());
|
$this->assertSame('2', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGroupByChoices()
|
public function testGroupByChoices()
|
||||||
@ -537,7 +537,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$field->bind('2');
|
$field->bind('2');
|
||||||
|
|
||||||
$this->assertSame('2', $field->getClientData());
|
$this->assertSame('2', $field->getViewData());
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')),
|
'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')),
|
||||||
'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')),
|
'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')),
|
||||||
@ -716,7 +716,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertSame($entity1, $field->getData());
|
$this->assertSame($entity1, $field->getData());
|
||||||
$this->assertSame('foo', $field->getClientData());
|
$this->assertSame('foo', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitCompositeStringIdentifier()
|
public function testSubmitCompositeStringIdentifier()
|
||||||
@ -738,7 +738,7 @@ class EntityTypeTest extends TypeTestCase
|
|||||||
|
|
||||||
$this->assertTrue($field->isSynchronized());
|
$this->assertTrue($field->isSynchronized());
|
||||||
$this->assertSame($entity1, $field->getData());
|
$this->assertSame($entity1, $field->getData());
|
||||||
$this->assertSame('0', $field->getClientData());
|
$this->assertSame('0', $field->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetManagerForClassIfNoEm()
|
public function testGetManagerForClassIfNoEm()
|
||||||
|
@ -27,7 +27,7 @@ class FormExtension extends \Twig_Extension
|
|||||||
* This property is public so that it can be accessed directly from compiled
|
* This property is public so that it can be accessed directly from compiled
|
||||||
* templates without having to call a getter, which slightly decreases performance.
|
* templates without having to call a getter, which slightly decreases performance.
|
||||||
*
|
*
|
||||||
* @var \Symfony\Component\Form\FormRendererInterface
|
* @var TwigRendererInterface
|
||||||
*/
|
*/
|
||||||
public $renderer;
|
public $renderer;
|
||||||
|
|
||||||
|
@ -147,8 +147,9 @@
|
|||||||
{% if widget == 'single_text' %}
|
{% if widget == 'single_text' %}
|
||||||
{{ block('form_widget_simple') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
|
||||||
<div {{ block('widget_container_attributes') }}>
|
<div {{ block('widget_container_attributes') }}>
|
||||||
{{ 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 %}
|
{{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
@ -365,7 +365,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
$container->setParameter('templating.helper.code.file_link_format', isset($links[$ide]) ? $links[$ide] : $ide);
|
$container->setParameter('templating.helper.code.file_link_format', isset($links[$ide]) ? $links[$ide] : $ide);
|
||||||
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
|
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
|
||||||
$container->setParameter('templating.hinclude.default_template', $config['hinclude_default_template']);
|
$container->setParameter('fragment.renderer.hinclude.global_template', $config['hinclude_default_template']);
|
||||||
|
|
||||||
if ($container->getParameter('kernel.debug')) {
|
if ($container->getParameter('kernel.debug')) {
|
||||||
$loader->load('templating_debug.xml');
|
$loader->load('templating_debug.xml');
|
||||||
|
@ -40,7 +40,9 @@ class ContainerAwareHIncludeFragmentRenderer extends HIncludeFragmentRenderer
|
|||||||
*/
|
*/
|
||||||
public function render($uri, Request $request, array $options = array())
|
public function render($uri, Request $request, array $options = array())
|
||||||
{
|
{
|
||||||
if (!$this->templating) {
|
// setting the templating cannot be done in the constructor
|
||||||
|
// as it would lead to an infinite recursion in the service container
|
||||||
|
if (!$this->hasTemplating()) {
|
||||||
$this->setTemplating($this->container->get('templating'));
|
$this->setTemplating($this->container->get('templating'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
<?php if ($widget == 'single_text'): ?>
|
<?php if ($widget == 'single_text'): ?>
|
||||||
<?php echo $view['form']->block($form, 'form_widget_simple'); ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple'); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php $vars = $widget == 'text' ? array('attr' => array('size' => 1)) : array() ?>
|
||||||
<div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
|
<div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
|
||||||
<?php
|
<?php
|
||||||
// There should be no spaces between the colons and the widgets, that's why
|
// There should be no spaces between the colons and the widgets, that's why
|
||||||
// this block is written in a single PHP tag
|
// this block is written in a single PHP tag
|
||||||
echo $view['form']->widget($form['hour'], array('attr' => array('size' => 1)));
|
echo $view['form']->widget($form['hour'], $vars);
|
||||||
|
|
||||||
if ($with_minutes) {
|
if ($with_minutes) {
|
||||||
echo ':';
|
echo ':';
|
||||||
echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
|
echo $view['form']->widget($form['minute'], $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($with_seconds) {
|
if ($with_seconds) {
|
||||||
echo ':';
|
echo ':';
|
||||||
echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
|
echo $view['form']->widget($form['second'], $vars);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Fragment;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class ContainerAwareHIncludeFragmentRendererTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testRender()
|
||||||
|
{
|
||||||
|
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||||
|
$container->expects($this->once())
|
||||||
|
->method('get')
|
||||||
|
->will($this->returnValue($this->getMock('\Twig_Environment')))
|
||||||
|
;
|
||||||
|
$renderer = new ContainerAwareHIncludeFragmentRenderer($container);
|
||||||
|
$renderer->render('/', Request::create('/'));
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,7 @@
|
|||||||
"symfony/stopwatch": ">=2.2,<2.4-dev",
|
"symfony/stopwatch": ">=2.2,<2.4-dev",
|
||||||
"symfony/templating": "~2.1",
|
"symfony/templating": "~2.1",
|
||||||
"symfony/translation": ">=2.2,<2.4-dev",
|
"symfony/translation": ">=2.2,<2.4-dev",
|
||||||
"doctrine/common": ">=2.2,<2.4-dev"
|
"doctrine/common": "~2.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/finder": "~2.0",
|
"symfony/finder": "~2.0",
|
||||||
|
@ -30,6 +30,8 @@ class Cookie
|
|||||||
'D, d M Y H:i:s T',
|
'D, d M Y H:i:s T',
|
||||||
'D, d-M-y H:i:s T',
|
'D, d-M-y H:i:s T',
|
||||||
'D, d-M-Y H:i:s T',
|
'D, d-M-Y H:i:s T',
|
||||||
|
'D, d-m-y H:i:s T',
|
||||||
|
'D, d-m-Y H:i:s T',
|
||||||
'D M j G:i:s Y',
|
'D M j G:i:s Y',
|
||||||
'D M d H:i:s Y T',
|
'D M d H:i:s Y T',
|
||||||
);
|
);
|
||||||
@ -205,6 +207,11 @@ class Cookie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// attempt a fallback for unusual formatting
|
||||||
|
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
|
||||||
|
return $date->getTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue));
|
throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +56,12 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
return array(
|
return array(
|
||||||
array('foo=bar; expires=Fri, 31-Jul-2020 08:49:37 GMT'),
|
array('foo=bar; expires=Fri, 31-Jul-2020 08:49:37 GMT'),
|
||||||
array('foo=bar; expires=Fri, 31 Jul 2020 08:49:37 GMT'),
|
array('foo=bar; expires=Fri, 31 Jul 2020 08:49:37 GMT'),
|
||||||
|
array('foo=bar; expires=Fri, 31-07-2020 08:49:37 GMT'),
|
||||||
|
array('foo=bar; expires=Fri, 31-07-20 08:49:37 GMT'),
|
||||||
array('foo=bar; expires=Friday, 31-Jul-20 08:49:37 GMT'),
|
array('foo=bar; expires=Friday, 31-Jul-20 08:49:37 GMT'),
|
||||||
array('foo=bar; expires=Fri Jul 31 08:49:37 2020'),
|
array('foo=bar; expires=Fri Jul 31 08:49:37 2020'),
|
||||||
array('foo=bar; expires=\'Fri Jul 31 08:49:37 2020\''),
|
array('foo=bar; expires=\'Fri Jul 31 08:49:37 2020\''),
|
||||||
|
array('foo=bar; expires=Friday July 31st 2020, 08:49:37 GMT'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +89,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
|
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
Cookie::FromString('foo=bar; expires=foo');
|
Cookie::FromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
||||||
|
@ -46,7 +46,7 @@ class Link
|
|||||||
*/
|
*/
|
||||||
public function __construct(\DOMNode $node, $currentUri, $method = 'GET')
|
public function __construct(\DOMNode $node, $currentUri, $method = 'GET')
|
||||||
{
|
{
|
||||||
if (!in_array(substr($currentUri, 0, 4), array('http', 'file'))) {
|
if (!in_array(strtolower(substr($currentUri, 0, 4)), array('http', 'file'))) {
|
||||||
throw new \InvalidArgumentException(sprintf('Current URI must be an absolute URL ("%s").', $currentUri));
|
throw new \InvalidArgumentException(sprintf('Current URI must be an absolute URL ("%s").', $currentUri));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
|||||||
// BC
|
// BC
|
||||||
if ($innerType instanceof AbstractType) {
|
if ($innerType instanceof AbstractType) {
|
||||||
/* @var AbstractType $innerType */
|
/* @var AbstractType $innerType */
|
||||||
|
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
|
||||||
$innerType->setExtensions($typeExtensions);
|
$innerType->setExtensions($typeExtensions);
|
||||||
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->innerType = $innerType;
|
$this->innerType = $innerType;
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||||
|
<body>
|
||||||
|
<trans-unit id="28">
|
||||||
|
<source>This form should not contain extra fields.</source>
|
||||||
|
<target>Αυτή η φόρμα δεν πρέπει να περιέχει επιπλέον πεδία.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="29">
|
||||||
|
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
|
||||||
|
<target>Το αρχείο είναι πολύ μεγάλο. Παρακαλούμε προσπαθήστε να ανεβάσετε ένα μικρότερο αρχείο.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="30">
|
||||||
|
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||||
|
<target>Το CSRF token δεν είναι έγκυρο. Παρακαλούμε δοκιμάστε να υποβάλετε τη φόρμα ξανά.</target>
|
||||||
|
</trans-unit>
|
||||||
|
</body>
|
||||||
|
</file>
|
||||||
|
</xliff>
|
@ -1533,11 +1533,11 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_hour"]
|
[@id="name_hour"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="4"][@selected="selected"]]
|
[./option[@value="4"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_minute"]
|
[@id="name_minute"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="5"][@selected="selected"]]
|
[./option[@value="5"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
[count(./select)=2]
|
[count(./select)=2]
|
||||||
@ -1557,17 +1557,17 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_hour"]
|
[@id="name_hour"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="4"][@selected="selected"]]
|
[./option[@value="4"][@selected="selected"]]
|
||||||
[count(./option)>23]
|
[count(./option)>23]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_minute"]
|
[@id="name_minute"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="5"][@selected="selected"]]
|
[./option[@value="5"][@selected="selected"]]
|
||||||
[count(./option)>59]
|
[count(./option)>59]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_second"]
|
[@id="name_second"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="6"][@selected="selected"]]
|
[./option[@value="6"][@selected="selected"]]
|
||||||
[count(./option)>59]
|
[count(./option)>59]
|
||||||
]
|
]
|
||||||
@ -1618,6 +1618,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@type="time"]
|
[@type="time"]
|
||||||
[@name="name"]
|
[@name="name"]
|
||||||
[@value="04:05"]
|
[@value="04:05"]
|
||||||
|
[not(@size)]
|
||||||
'
|
'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -601,9 +601,11 @@ class FormTypeTest extends TypeTestCase
|
|||||||
// BC
|
// BC
|
||||||
public function testPropertyPathFalseImpliesDefaultNotMapped()
|
public function testPropertyPathFalseImpliesDefaultNotMapped()
|
||||||
{
|
{
|
||||||
|
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||||
$form = $this->factory->createNamed('name', 'form', null, array(
|
$form = $this->factory->createNamed('name', 'form', null, array(
|
||||||
'property_path' => false,
|
'property_path' => false,
|
||||||
));
|
));
|
||||||
|
restore_error_handler();
|
||||||
|
|
||||||
$this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
|
$this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
|
||||||
$this->assertFalse($form->getConfig()->getMapped());
|
$this->assertFalse($form->getConfig()->getMapped());
|
||||||
@ -661,4 +663,15 @@ class FormTypeTest extends TypeTestCase
|
|||||||
$this->assertSame('foo', $view->vars['data']);
|
$this->assertSame('foo', $view->vars['data']);
|
||||||
$this->assertSame('bar', $view->vars['value']);
|
$this->assertSame('bar', $view->vars['value']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/symfony/symfony/issues/6862
|
||||||
|
public function testPassZeroLabelToView()
|
||||||
|
{
|
||||||
|
$view = $this->factory->create('form', null, array(
|
||||||
|
'label' => '0'
|
||||||
|
))
|
||||||
|
->createView();
|
||||||
|
|
||||||
|
$this->assertSame('0', $view->vars['label']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class MoneyTypeTest extends LocalizedTestCase
|
|||||||
$view1 = $form1->createView();
|
$view1 = $form1->createView();
|
||||||
$view2 = $form2->createView();
|
$view2 = $form2->createView();
|
||||||
|
|
||||||
$this->assertSame('{{ widget }} £', $view1->get('money_pattern'));
|
$this->assertSame('{{ widget }} £', $view1->vars['money_pattern']);
|
||||||
$this->assertSame('{{ widget }} €', $view2->get('money_pattern'));
|
$this->assertSame('{{ widget }} €', $view2->vars['money_pattern']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ class TimeTypeTest extends LocalizedTestCase
|
|||||||
|
|
||||||
$form->setData(new \DateTime('03:04:05 UTC'));
|
$form->setData(new \DateTime('03:04:05 UTC'));
|
||||||
|
|
||||||
$this->assertEquals(array('hour' => 3), $form->getClientData());
|
$this->assertEquals(array('hour' => 3), $form->getViewData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetDataWithSeconds()
|
public function testSetDataWithSeconds()
|
||||||
|
@ -32,13 +32,6 @@ abstract class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase
|
|||||||
$this->factory = Forms::createFormFactoryBuilder()
|
$this->factory = Forms::createFormFactoryBuilder()
|
||||||
->addExtensions($this->getExtensions())
|
->addExtensions($this->getExtensions())
|
||||||
->getFormFactory();
|
->getFormFactory();
|
||||||
|
|
||||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
restore_error_handler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getExtensions()
|
protected function getExtensions()
|
||||||
|
@ -253,6 +253,16 @@ class Response
|
|||||||
$this->headers->set('expires', -1);
|
$this->headers->set('expires', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if we need to remove Cache-Control for ssl encrypted downloads when using IE < 9
|
||||||
|
* @link http://support.microsoft.com/kb/323308
|
||||||
|
*/
|
||||||
|
if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) {
|
||||||
|
if(intval(preg_replace("/(MSIE )(.*?);/", "$2", $match[0])) < 9) {
|
||||||
|
$this->headers->remove('Cache-Control');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,6 +326,75 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
|
$this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNoCacheControlHeaderOnAttachmentUsingHTTPSAndMSIE()
|
||||||
|
{
|
||||||
|
// Check for HTTPS and IE 8
|
||||||
|
$request = new Request();
|
||||||
|
$request->server->set('HTTPS', true);
|
||||||
|
$request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertFalse($response->headers->has('Cache-Control'));
|
||||||
|
|
||||||
|
// Check for IE 10 and HTTPS
|
||||||
|
$request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)');
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertTrue($response->headers->has('Cache-Control'));
|
||||||
|
|
||||||
|
// Check for IE 9 and HTTPS
|
||||||
|
$request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)');
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertTrue($response->headers->has('Cache-Control'));
|
||||||
|
|
||||||
|
// Check for IE 9 and HTTP
|
||||||
|
$request->server->set('HTTPS', false);
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertTrue($response->headers->has('Cache-Control'));
|
||||||
|
|
||||||
|
// Check for IE 8 and HTTP
|
||||||
|
$request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertTrue($response->headers->has('Cache-Control'));
|
||||||
|
|
||||||
|
// Check for non-IE and HTTPS
|
||||||
|
$request->server->set('HTTPS', true);
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertTrue($response->headers->has('Cache-Control'));
|
||||||
|
|
||||||
|
// Check for non-IE and HTTP
|
||||||
|
$request->server->set('HTTPS', false);
|
||||||
|
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
|
||||||
|
$response->prepare($request);
|
||||||
|
|
||||||
|
$this->assertTrue($response->headers->has('Cache-Control'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testPrepareDoesNothingIfContentTypeIsSet()
|
public function testPrepareDoesNothingIfContentTypeIsSet()
|
||||||
{
|
{
|
||||||
$response = new Response('foo');
|
$response = new Response('foo');
|
||||||
|
@ -4,6 +4,7 @@ CHANGELOG
|
|||||||
2.2.0
|
2.2.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* [BC BREAK] the path info for sub-request is now always _fragment (or whatever you configured instead of the default)
|
||||||
* added Symfony\Component\HttpKernel\EventListener\FragmentListener
|
* added Symfony\Component\HttpKernel\EventListener\FragmentListener
|
||||||
* added Symfony\Component\HttpKernel\UriSigner
|
* added Symfony\Component\HttpKernel\UriSigner
|
||||||
* added Symfony\Component\HttpKernel\FragmentRenderer and rendering strategies (in Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface)
|
* added Symfony\Component\HttpKernel\FragmentRenderer and rendering strategies (in Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface)
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
namespace Symfony\Component\HttpKernel\EventListener;
|
namespace Symfony\Component\HttpKernel\EventListener;
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||||
|
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
@ -25,6 +27,7 @@ class LocaleListener implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
private $router;
|
private $router;
|
||||||
private $defaultLocale;
|
private $defaultLocale;
|
||||||
|
private $locales = array();
|
||||||
|
|
||||||
public function __construct($defaultLocale = 'en', RequestContextAwareInterface $router = null)
|
public function __construct($defaultLocale = 'en', RequestContextAwareInterface $router = null)
|
||||||
{
|
{
|
||||||
@ -32,19 +35,24 @@ class LocaleListener implements EventSubscriberInterface
|
|||||||
$this->router = $router;
|
$this->router = $router;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onKernelResponse(FilterResponseEvent $event)
|
||||||
|
{
|
||||||
|
array_shift($this->locales);
|
||||||
|
|
||||||
|
// setting back the locale to the previous value
|
||||||
|
$locale = isset($this->locales[0]) ? $this->locales[0] : $this->defaultLocale;
|
||||||
|
$request = $event->getRequest();
|
||||||
|
$this->setLocale($request, $locale);
|
||||||
|
}
|
||||||
|
|
||||||
public function onKernelRequest(GetResponseEvent $event)
|
public function onKernelRequest(GetResponseEvent $event)
|
||||||
{
|
{
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
|
|
||||||
$request->setDefaultLocale($this->defaultLocale);
|
$request->setDefaultLocale($this->defaultLocale);
|
||||||
|
$this->setLocale($request, $request->attributes->get('_locale', $this->defaultLocale));
|
||||||
|
|
||||||
if ($locale = $request->attributes->get('_locale')) {
|
array_unshift($this->locales, $request->getLocale());
|
||||||
$request->setLocale($locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $this->router) {
|
|
||||||
$this->router->getContext()->setParameter('_locale', $request->getLocale());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents()
|
||||||
@ -52,6 +60,16 @@ class LocaleListener implements EventSubscriberInterface
|
|||||||
return array(
|
return array(
|
||||||
// must be registered after the Router to have access to the _locale
|
// must be registered after the Router to have access to the _locale
|
||||||
KernelEvents::REQUEST => array(array('onKernelRequest', 16)),
|
KernelEvents::REQUEST => array(array('onKernelRequest', 16)),
|
||||||
|
KernelEvents::RESPONSE => 'onKernelResponse',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setLocale(Request $request, $locale)
|
||||||
|
{
|
||||||
|
$request->setLocale($locale);
|
||||||
|
|
||||||
|
if (null !== $this->router) {
|
||||||
|
$this->router->getContext()->setParameter('_locale', $request->getLocale());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,16 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
$this->templating = $templating;
|
$this->templating = $templating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a templating engine has been set.
|
||||||
|
*
|
||||||
|
* @return Boolean true if the templating engine has been set, false otherwise
|
||||||
|
*/
|
||||||
|
public function hasTemplating()
|
||||||
|
{
|
||||||
|
return null !== $this->templating;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
@ -73,6 +83,9 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
$uri = $this->signer->sign($this->generateFragmentUri($uri, $request));
|
$uri = $this->signer->sign($this->generateFragmentUri($uri, $request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
|
||||||
|
$uri = str_replace('&', '&', $uri);
|
||||||
|
|
||||||
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
|
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
|
||||||
if (null !== $this->templating && $template && $this->templateExists($template)) {
|
if (null !== $this->templating && $template && $this->templateExists($template)) {
|
||||||
$content = $this->templating->render($template);
|
$content = $this->templating->render($template);
|
||||||
|
@ -38,7 +38,7 @@ class HIncludeFragmentRendererTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo'));
|
$strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo'));
|
||||||
|
|
||||||
$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());
|
$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());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRenderWithUri()
|
public function testRenderWithUri()
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"symfony/form": "~2.0",
|
"symfony/form": "~2.0",
|
||||||
"symfony/routing": ">=2.2,<2.4-dev",
|
"symfony/routing": ">=2.2,<2.4-dev",
|
||||||
"symfony/validator": ">=2.2,<2.4-dev",
|
"symfony/validator": ">=2.2,<2.4-dev",
|
||||||
"doctrine/common": ">=2.2,<2.4-dev",
|
"doctrine/common": "~2.2",
|
||||||
"doctrine/dbal": "~2.2",
|
"doctrine/dbal": "~2.2",
|
||||||
"psr/log": "~1.0"
|
"psr/log": "~1.0"
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user