File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 5555 header ('Location: http://foo.example. ' , true , 301 );
5656 break ;
5757
58+ case '/301/invalid ' :
59+ header ('Location: //?foo=bar ' , true , 301 );
60+ break ;
61+
5862 case '/302 ' :
5963 if (!isset ($ vars ['HTTP_AUTHORIZATION ' ])) {
6064 header ('Location: http://localhost:8057/ ' , true , 302 );
Original file line number Diff line number Diff line change @@ -259,6 +259,20 @@ public function testRedirects()
259259 $ this ->assertSame ($ expected , $ filteredHeaders );
260260 }
261261
262+ public function testInvalidRedirect ()
263+ {
264+ $ client = $ this ->getHttpClient (__FUNCTION__ );
265+ $ response = $ client ->request ('GET ' , 'http://localhost:8057/301/invalid ' );
266+
267+ $ this ->assertSame (301 , $ response ->getStatusCode ());
268+ $ this ->assertSame (['//?foo=bar ' ], $ response ->getHeaders (false )['location ' ]);
269+ $ this ->assertSame (0 , $ response ->getInfo ('redirect_count ' ));
270+ $ this ->assertNull ($ response ->getInfo ('redirect_url ' ));
271+
272+ $ this ->expectException (RedirectionExceptionInterface::class);
273+ $ response ->getHeaders ();
274+ }
275+
262276 public function testRelativeRedirects ()
263277 {
264278 $ client = $ this ->getHttpClient (__FUNCTION__ );
You can’t perform that action at this time.
0 commit comments