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 55
55
header ('Location: http://foo.example. ' , true , 301 );
56
56
break ;
57
57
58
+ case '/301/invalid ' :
59
+ header ('Location: //?foo=bar ' , true , 301 );
60
+ break ;
61
+
58
62
case '/302 ' :
59
63
if (!isset ($ vars ['HTTP_AUTHORIZATION ' ])) {
60
64
header ('Location: http://localhost:8057/ ' , true , 302 );
Original file line number Diff line number Diff line change @@ -259,6 +259,20 @@ public function testRedirects()
259
259
$ this ->assertSame ($ expected , $ filteredHeaders );
260
260
}
261
261
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
+
262
276
public function testRelativeRedirects ()
263
277
{
264
278
$ client = $ this ->getHttpClient (__FUNCTION__ );
You can’t perform that action at this time.
0 commit comments