This repository was archived by the owner on Jun 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -321,9 +321,12 @@ public function getQuery(string $name = null)
321321 */
322322 public function setQuery (array $ query ) : Request
323323 {
324- $ this ->query = $ query ;
325324 $ this ->queryString = http_build_query ($ query );
326325
326+ // Ensure that we get a value for getQuery() that's consistent with the query string, and whose scalar values
327+ // have all been converted to strings, to get a result similar to what we'd get with an incoming HTTP request.
328+ parse_str ($ this ->queryString , $ this ->query );
329+
327330 $ this ->requestUri = $ this ->path ;
328331
329332 if ($ this ->queryString !== '' ) {
@@ -362,7 +365,9 @@ public function getPost(string $name = null)
362365 */
363366 public function setPost (array $ post ) : Request
364367 {
365- $ this ->post = $ post ;
368+ // Ensure that we get a value for getQuery() that's consistent with the query string, and whose scalar values
369+ // have all been converted to strings, to get a result similar to what we'd get with an incoming HTTP request.
370+ parse_str (http_build_query ($ post ), $ this ->post );
366371
367372 if (! $ this ->isContentType ('multipart/form-data ' )) {
368373 $ body = http_build_query ($ post );
You can’t perform that action at this time.
0 commit comments