Skip to content

Commit b4aa027

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Show exception is checked twice in ExceptionController of twig allow SSI fragments configuration in XML files Display a better error message when the toolbar cannot be displayed render hidden _method field in form_rest() return fallback locales whenever possible
2 parents b0bc9fe + 9fc9cc4 commit b4aa027

File tree

12 files changed

+65
-5
lines changed

12 files changed

+65
-5
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
{%- endblock form -%}
268268

269269
{%- block form_start -%}
270+
{%- do form.setMethodRendered() -%}
270271
{% set method = method|upper %}
271272
{%- if method in ["GET", "POST"] -%}
272273
{% set form_method = method %}
@@ -306,6 +307,20 @@
306307
{{- form_row(child) -}}
307308
{% endif %}
308309
{%- endfor %}
310+
311+
{% if not form.methodRendered %}
312+
{%- do form.setMethodRendered() -%}
313+
{% set method = method|upper %}
314+
{%- if method in ["GET", "POST"] -%}
315+
{% set form_method = method %}
316+
{%- else -%}
317+
{% set form_method = "POST" %}
318+
{%- endif -%}
319+
320+
{%- if form_method != method -%}
321+
<input type="hidden" name="_method" value="{{ method }}" />
322+
{%- endif -%}
323+
{% endif %}
309324
{% endblock form_rest %}
310325

311326
{# Support #}

src/Symfony/Bridge/Twig/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"symfony/asset": "~2.7|~3.0.0",
2424
"symfony/finder": "~2.3|~3.0.0",
25-
"symfony/form": "^2.8.19",
25+
"symfony/form": "^2.8.23",
2626
"symfony/http-kernel": "~2.8|~3.0.0",
2727
"symfony/polyfill-intl-icu": "~1.0",
2828
"symfony/routing": "~2.2|~3.0.0",
@@ -36,6 +36,9 @@
3636
"symfony/var-dumper": "~2.7.16|~2.8.9|~3.0.9",
3737
"symfony/expression-language": "~2.4|~3.0.0"
3838
},
39+
"conflict": {
40+
"symfony/form": "<2.8.23"
41+
},
3942
"suggest": {
4043
"symfony/finder": "",
4144
"symfony/asset": "For using the AssetExtension",

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<xsd:element name="form" type="form" minOccurs="0" maxOccurs="1" />
2323
<xsd:element name="csrf-protection" type="csrf_protection" minOccurs="0" maxOccurs="1" />
2424
<xsd:element name="esi" type="esi" minOccurs="0" maxOccurs="1" />
25+
<xsd:element name="ssi" type="ssi" minOccurs="0" maxOccurs="1" />
2526
<xsd:element name="fragments" type="fragments" minOccurs="0" maxOccurs="1" />
2627
<xsd:element name="profiler" type="profiler" minOccurs="0" maxOccurs="1" />
2728
<xsd:element name="router" type="router" minOccurs="0" maxOccurs="1" />
@@ -65,6 +66,10 @@
6566
<xsd:attribute name="enabled" type="xsd:boolean" />
6667
</xsd:complexType>
6768

69+
<xsd:complexType name="ssi">
70+
<xsd:attribute name="enabled" type="xsd:boolean" />
71+
</xsd:complexType>
72+
6873
<xsd:complexType name="fragments">
6974
<xsd:attribute name="enabled" type="xsd:boolean" />
7075
<xsd:attribute name="path" type="xsd:string" />

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
'esi' => array(
1717
'enabled' => true,
1818
),
19+
'ssi' => array(
20+
'enabled' => true,
21+
),
1922
'profiler' => array(
2023
'only_exceptions' => true,
2124
'enabled' => false,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<framework:csrf-protection field-name="_csrf"/>
1313
</framework:form>
1414
<framework:esi enabled="true" />
15+
<framework:ssi enabled="true" />
1516
<framework:profiler only-exceptions="true" enabled="false" />
1617
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />
1718
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" />

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ framework:
1010
enabled: true
1111
esi:
1212
enabled: true
13+
ssi:
14+
enabled: true
1315
profiler:
1416
only_exceptions: true
1517
enabled: false

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ public function testEsi()
9999
$this->assertTrue($container->hasDefinition('esi'), '->registerEsiConfiguration() loads esi.xml');
100100
}
101101

102+
public function testSsi()
103+
{
104+
$container = $this->createContainerFromFile('full');
105+
106+
$this->assertTrue($container->hasDefinition('ssi'), '->registerSsiConfiguration() loads ssi.xml');
107+
}
108+
102109
public function testEnabledProfiler()
103110
{
104111
$container = $this->createContainerFromFile('profiler');

src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function findTemplate(Request $request, $format, $code, $showException
123123
// default to a generic HTML exception
124124
$request->setRequestFormat('html');
125125

126-
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
126+
return sprintf('@Twig/Exception/%s.html.twig', $name);
127127
}
128128

129129
// to be removed when the minimum required version of Twig is >= 3.0

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,17 @@
6060
}
6161
},
6262
function(xhr) {
63+
var errorToolbarHtml = '
64+
<style>
65+
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
66+
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
67+
.sfErrorToolbar a:hover { text-decoration: none; }
68+
</style>
69+
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
70+
';
71+
6372
if (xhr.status !== 0) {
64-
confirm('An error occurred while loading the web debug toolbar (' + xhr.status + ': ' + xhr.statusText + ').\n\nDo you want to open the profiler?') && (window.location = '{{ path("_profiler", { "token": token }) }}');
73+
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
6574
}
6675
},
6776
{'maxTries': 5}

src/Symfony/Component/Form/FormView.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
5353
*/
5454
private $rendered = false;
5555

56+
private $methodRendered = false;
57+
5658
public function __construct(FormView $parent = null)
5759
{
5860
$this->parent = $parent;
@@ -90,6 +92,19 @@ public function setRendered()
9092
return $this;
9193
}
9294

95+
/**
96+
* @return bool
97+
*/
98+
public function isMethodRendered()
99+
{
100+
return $this->methodRendered;
101+
}
102+
103+
public function setMethodRendered()
104+
{
105+
$this->methodRendered = true;
106+
}
107+
93108
/**
94109
* Returns a child by name (implements \ArrayAccess).
95110
*

0 commit comments

Comments
 (0)