@@ -108,13 +108,6 @@ public function initialize(array $query = array(), array $request = array(), arr
108108 $ this ->server = new ServerBag ($ server );
109109 $ this ->headers = new HeaderBag ($ this ->server ->getHeaders ());
110110
111- if ('application/x-www-form-urlencoded ' == $ this ->server ->get ('CONTENT_TYPE ' )
112- && in_array (strtoupper ($ this ->server ->get ('REQUEST_METHOD ' , 'GET ' ), array ('PUT ' , 'DELETE ' ))
113- ) {
114- parse_str ($ this ->getContent (), $ data );
115- $ this ->request = new ParameterBag ($ data );
116- }
117-
118111 $ this ->content = $ content ;
119112 $ this ->languages = null ;
120113 $ this ->charsets = null ;
@@ -134,7 +127,16 @@ public function initialize(array $query = array(), array $request = array(), arr
134127 */
135128 static public function createFromGlobals ()
136129 {
137- return new static ($ _GET , $ _POST , array (), $ _COOKIE , $ _FILES , $ _SERVER );
130+ $ request = new static ($ _GET , $ _POST , array (), $ _COOKIE , $ _FILES , $ _SERVER );
131+
132+ if ('application/x-www-form-urlencoded ' == $ request ->server ->get ('CONTENT_TYPE ' )
133+ && in_array (strtoupper ($ request ->server ->get ('REQUEST_METHOD ' , 'GET ' ), array ('PUT ' , 'DELETE ' ))
134+ ) {
135+ parse_str ($ this ->getContent (), $ data );
136+ $ request ->request = new ParameterBag ($ data );
137+ }
138+
139+ return $ request ;
138140 }
139141
140142 /**
0 commit comments