@@ -311,6 +311,39 @@ public function testOldInput()
311311 $ this ->assertSame ('fritz ' , old ('zibble ' ));
312312 }
313313
314+ /**
315+ * @runInSeparateProcess
316+ * @preserveGlobalState disabled
317+ */
318+ public function testOldInputSerializeData ()
319+ {
320+ $ this ->injectSessionMock ();
321+ // setup from RedirectResponseTest...
322+ $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
323+
324+ $ this ->config = new App ();
325+ $ this ->config ->baseURL = 'http://example.com/ ' ;
326+
327+ $ this ->routes = new RouteCollection (Services::locator (), new Modules ());
328+ Services::injectMock ('routes ' , $ this ->routes );
329+
330+ $ this ->request = new MockIncomingRequest ($ this ->config , new URI ('http://example.com ' ), null , new UserAgent ());
331+ Services::injectMock ('request ' , $ this ->request );
332+
333+ // setup & ask for a redirect...
334+ $ _SESSION = [];
335+ $ _GET = [];
336+ $ _POST = [
337+ 'zibble ' => serialize ('fritz ' ),
338+ ];
339+
340+ $ response = new RedirectResponse (new App ());
341+ $ response ->withInput ();
342+
343+ // serialized parameters are only HTML-escaped.
344+ $ this ->assertSame ('s:5:"fritz"; ' , old ('zibble ' ));
345+ }
346+
314347 /**
315348 * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492
316349 * @runInSeparateProcess
0 commit comments