Merge branch '2.1' into 2.2
* 2.1: 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" merged branch jfcixmedia/2.1 (PR #5838) [DomCrawler] lowered parsed protocol string (fixes #6986) Conflicts: composer.json src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php src/Symfony/Component/Routing/composer.json src/Symfony/Component/Security/composer.json src/Symfony/Component/Validator/composer.json
This commit is contained in:
commit
825dc17fbc
@ -27,7 +27,7 @@ class FormExtension extends \Twig_Extension
|
||||
* This property is public so that it can be accessed directly from compiled
|
||||
* templates without having to call a getter, which slightly decreases performance.
|
||||
*
|
||||
* @var \Symfony\Component\Form\FormRendererInterface
|
||||
* @var TwigRendererInterface
|
||||
*/
|
||||
public $renderer;
|
||||
|
||||
|
@ -147,8 +147,9 @@
|
||||
{% if widget == 'single_text' %}
|
||||
{{ block('form_widget_simple') }}
|
||||
{% else %}
|
||||
{% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
|
||||
<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>
|
||||
{% endif %}
|
||||
{% endspaceless %}
|
||||
|
@ -1,20 +1,21 @@
|
||||
<?php if ($widget == 'single_text'): ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple'); ?>
|
||||
<?php else: ?>
|
||||
<?php $vars = $widget == 'text' ? array('attr' => array('size' => 1)) : array() ?>
|
||||
<div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
|
||||
<?php
|
||||
// There should be no spaces between the colons and the widgets, that's why
|
||||
// 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) {
|
||||
echo ':';
|
||||
echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
|
||||
echo $view['form']->widget($form['minute'], $vars);
|
||||
}
|
||||
|
||||
if ($with_seconds) {
|
||||
echo ':';
|
||||
echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
|
||||
echo $view['form']->widget($form['second'], $vars);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -26,7 +26,7 @@
|
||||
"symfony/stopwatch": ">=2.2,<2.3-dev",
|
||||
"symfony/templating": "~2.1",
|
||||
"symfony/translation": ">=2.2,<2.3-dev",
|
||||
"doctrine/common": ">=2.2,<2.4-dev"
|
||||
"doctrine/common": "~2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"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 M j G:i:s Y',
|
||||
'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));
|
||||
}
|
||||
|
||||
|
@ -56,9 +56,12 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
||||
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-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=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()
|
||||
{
|
||||
$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()
|
||||
|
@ -46,7 +46,7 @@ class Link
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -1533,11 +1533,11 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
[
|
||||
./select
|
||||
[@id="name_hour"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="4"][@selected="selected"]]
|
||||
/following-sibling::select
|
||||
[@id="name_minute"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="5"][@selected="selected"]]
|
||||
]
|
||||
[count(./select)=2]
|
||||
@ -1557,17 +1557,17 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
[
|
||||
./select
|
||||
[@id="name_hour"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="4"][@selected="selected"]]
|
||||
[count(./option)>23]
|
||||
/following-sibling::select
|
||||
[@id="name_minute"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="5"][@selected="selected"]]
|
||||
[count(./option)>59]
|
||||
/following-sibling::select
|
||||
[@id="name_second"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="6"][@selected="selected"]]
|
||||
[count(./option)>59]
|
||||
]
|
||||
@ -1618,6 +1618,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
[@type="time"]
|
||||
[@name="name"]
|
||||
[@value="04:05"]
|
||||
[not(@size)]
|
||||
'
|
||||
);
|
||||
}
|
||||
|
@ -663,4 +663,15 @@ class FormTypeTest extends TypeTestCase
|
||||
$this->assertSame('foo', $view->vars['data']);
|
||||
$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']);
|
||||
}
|
||||
}
|
||||
|
@ -253,6 +253,16 @@ class Response
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -326,6 +326,75 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
||||
$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()
|
||||
{
|
||||
$response = new Response('foo');
|
||||
|
@ -25,7 +25,7 @@
|
||||
"symfony/form": "~2.0",
|
||||
"symfony/routing": ">=2.2,<2.3-dev",
|
||||
"symfony/validator": ">=2.2,<2.3-dev",
|
||||
"doctrine/common": ">=2.2,<2.4-dev",
|
||||
"doctrine/common": "~2.2",
|
||||
"doctrine/dbal": "~2.2",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
|
Reference in New Issue
Block a user