@@ -7452,9 +7452,38 @@ public function __construct(Config $config)
74527452        $ this debug  = $ configgetDebug ();
74537453    }
74547454
7455+     private  function  parseBody (string  $ body/*: ?object*/ 
7456+     {
7457+         $ firstsubstr ($ body0 , 1 );
7458+         if  ($ first'[ '  || $ first'{ ' ) {
7459+             $ objectjson_decode ($ body
7460+             $ causeCodejson_last_error ();
7461+             if  ($ causeCodeJSON_ERROR_NONE ) {
7462+                 $ objectnull ;
7463+             }
7464+         } else  {
7465+             parse_str ($ body$ input
7466+             foreach  ($ inputas  $ key$ value
7467+                 if  (substr ($ key9 ) == '__is_null ' ) {
7468+                     $ inputsubstr ($ key0 , -9 )] = null ;
7469+                     unset($ input$ key
7470+                 }
7471+             }
7472+             $ objectobject ) $ input
7473+         }
7474+         return  $ object
7475+     }
7476+ 
74557477    public  function  handle (ServerRequestInterface $ requestResponseInterface 
74567478    {
74577479        $ responsenull ;
7480+         $ body$ requestgetBody ();
7481+         if  ($ bodyisReadable () && $ bodyisSeekable ()) {
7482+             $ contents$ bodygetContents ();
7483+             $ bodyrewind ();
7484+             $ parsedBody$ this parseBody ($ contents
7485+             $ request$ requestwithParsedBody ($ parsedBody
7486+         }
74587487        try  {
74597488            $ response$ this router ->route ($ request
74607489        } catch  (\Throwable   $ e
@@ -7636,37 +7665,13 @@ public function getOpenApiBase(): array
76367665
76377666class  RequestFactory
76387667{
7639-     private  static  function  parseBody (string  $ body/*: ?object*/ 
7640-     {
7641-         $ firstsubstr ($ body0 , 1 );
7642-         if  ($ first'[ '  || $ first'{ ' ) {
7643-             $ objectjson_decode ($ body
7644-             $ causeCodejson_last_error ();
7645-             if  ($ causeCodeJSON_ERROR_NONE ) {
7646-                 $ objectnull ;
7647-             }
7648-         } else  {
7649-             parse_str ($ body$ input
7650-             foreach  ($ inputas  $ key$ value
7651-                 if  (substr ($ key9 ) == '__is_null ' ) {
7652-                     $ inputsubstr ($ key0 , -9 )] = null ;
7653-                     unset($ input$ key
7654-                 }
7655-             }
7656-             $ objectobject ) $ input
7657-         }
7658-         return  $ object
7659-     }
7660- 
76617668    public  static  function  fromGlobals (): ServerRequestInterface 
76627669    {
76637670        $ psr17Factorynew  Psr17Factory ();
76647671        $ creatornew  ServerRequestCreator ($ psr17Factory$ psr17Factory$ psr17Factory$ psr17Factory
76657672        $ serverRequest$ creatorfromGlobals ();
7666-         $ bodyfile_get_contents ('php://input ' );
7667-         if  ($ body
7668-             $ serverRequest$ serverRequestwithParsedBody (self ::parseBody ($ body
7669-         }
7673+         $ stream$ psr17FactorycreateStreamFromResource ('php://input ' );
7674+         $ serverRequest$ serverRequestwithBody ($ stream
76707675        return  $ serverRequest
76717676    }
76727677
@@ -7689,7 +7694,6 @@ public static function fromString(string $request): ServerRequestInterface
76897694            $ stream$ psr17FactorycreateStream ($ body
76907695            $ streamrewind ();
76917696            $ serverRequest$ serverRequestwithBody ($ stream
7692-             $ serverRequest$ serverRequestwithParsedBody (self ::parseBody ($ body
76937697        }
76947698        return  $ serverRequest
76957699    }
0 commit comments