File tree 6 files changed +27
-13
lines changed
src/Symfony/Bundle/FrameworkBundle
Tests/DependencyInjection
6 files changed +27
-13
lines changed Original file line number Diff line number Diff line change 8
8
option together with the ` Valid ` constraint instead. Contrary to
9
9
"cascade_validation", "constraints" must be set on the respective child forms,
10
10
not the parent form.
11
-
11
+
12
12
Before:
13
-
13
+
14
14
``` php
15
15
$form = $this->createForm('form', $article, array('cascade_validation' => true))
16
16
->add('author', new AuthorType())
17
17
->getForm();
18
18
```
19
-
19
+
20
20
After:
21
-
21
+
22
22
``` php
23
23
use Symfony\Component\Validator\Constraints\Valid;
24
-
24
+
25
25
$form = $this->createForm('form', $article)
26
26
->add('author', new AuthorType(), array(
27
27
'constraints' => new Valid(),
28
28
))
29
29
->getForm();
30
30
```
31
-
31
+
32
32
Alternatively, you can set the ` Valid ` constraint in the model itself:
33
-
33
+
34
34
``` php
35
35
use Symfony\Component\Validator\Constraints as Assert;
36
-
36
+
37
37
class Article
38
38
{
39
39
/**
@@ -197,3 +197,17 @@ to the toolbar templates:
197
197
{% endset %}
198
198
{% endblock %}
199
199
```
200
+
201
+ FrameworkBundle
202
+ ---------------
203
+
204
+ * The default value of the parameter ` session ` .` cookie_httponly ` is now ` true ` .
205
+ It prevents scripting languages, such as JavaScript to access the cookie,
206
+ which help to reduce identity theft through XSS attacks. If your
207
+ application needs to access the session cookie, override this parameter:
208
+
209
+ ``` yaml
210
+ framework :
211
+ session :
212
+ cookie_httponly : false
213
+ ` ` `
Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
340
340
->scalarNode ('cookie_path ' )->end ()
341
341
->scalarNode ('cookie_domain ' )->end ()
342
342
->booleanNode ('cookie_secure ' )->end ()
343
- ->booleanNode ('cookie_httponly ' )->end ()
343
+ ->booleanNode ('cookie_httponly ' )->defaultTrue ()-> end ()
344
344
->scalarNode ('gc_divisor ' )->end ()
345
345
->scalarNode ('gc_probability ' )->defaultValue (1 )->end ()
346
346
->scalarNode ('gc_maxlifetime ' )->end ()
Original file line number Diff line number Diff line change 32
32
'cookie_path ' => '/ ' ,
33
33
'cookie_domain ' => 'example.com ' ,
34
34
'cookie_secure ' => true ,
35
- 'cookie_httponly ' => true ,
35
+ 'cookie_httponly ' => false ,
36
36
'gc_maxlifetime ' => 90000 ,
37
37
'gc_divisor ' => 108 ,
38
38
'gc_probability ' => 1 ,
Original file line number Diff line number Diff line change 14
14
<framework : esi enabled =" true" />
15
15
<framework : profiler only-exceptions =" true" enabled =" false" />
16
16
<framework : router resource =" %kernel.root_dir%/config/routing.xml" type =" xml" />
17
- <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 =" true " save-path =" /path/to/sessions" />
17
+ <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 " save-path =" /path/to/sessions" />
18
18
<framework : request >
19
19
<framework : format name =" csv" >
20
20
<framework : mime-type >text/csv</framework : mime-type >
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ framework:
24
24
cookie_path : /
25
25
cookie_domain : example.com
26
26
cookie_secure : true
27
- cookie_httponly : true
27
+ cookie_httponly : false
28
28
gc_probability : 1
29
29
gc_divisor : 108
30
30
gc_maxlifetime : 90000
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ public function testSession()
149
149
$ this ->assertEquals ('/ ' , $ options ['cookie_path ' ]);
150
150
$ this ->assertEquals ('example.com ' , $ options ['cookie_domain ' ]);
151
151
$ this ->assertTrue ($ options ['cookie_secure ' ]);
152
- $ this ->assertTrue ($ options ['cookie_httponly ' ]);
152
+ $ this ->assertFalse ($ options ['cookie_httponly ' ]);
153
153
$ this ->assertEquals (108 , $ options ['gc_divisor ' ]);
154
154
$ this ->assertEquals (1 , $ options ['gc_probability ' ]);
155
155
$ this ->assertEquals (90000 , $ options ['gc_maxlifetime ' ]);
You can’t perform that action at this time.
0 commit comments