File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -163,20 +163,25 @@ exist::
163
163
// returns 'baz'
164
164
165
165
When PHP imports the request query, it handles request parameters like
166
- ``foo[bar]=baz `` in a special way as it creates an array. So you can get the
167
- `` foo `` parameter and you will get back an array with a `` bar `` element ::
166
+ ``foo[bar]=baz `` in a special way as it creates an array. The `` get() `` method
167
+ doesn't support returning arrays, so you need to use the following code ::
168
168
169
169
// the query string is '?foo[bar]=baz'
170
170
171
- $request->query->get( 'foo') ;
171
+ $request->query->all()[ 'foo'] ;
172
172
// returns ['bar' => 'baz']
173
173
174
174
$request->query->get('foo[bar]');
175
175
// returns null
176
176
177
- $request->query->get( 'foo') ['bar'];
177
+ $request->query->all()[ 'foo'] ['bar'];
178
178
// returns 'baz'
179
179
180
+ .. versionadded :: 5.1
181
+
182
+ The feature that removed array support in ``get() `` was introduced in
183
+ Symfony 5.1.
184
+
180
185
.. _component-foundation-attributes :
181
186
182
187
Thanks to the public ``attributes `` property, you can store additional data
You can’t perform that action at this time.
0 commit comments