@@ -32,18 +32,7 @@ public function match($pathinfo)
32
32
}
33
33
34
34
if ($ this ->allowSchemes ) {
35
- redirect_scheme:
36
- $ scheme = $ this ->context ->getScheme ();
37
- $ this ->context ->setScheme (current ($ this ->allowSchemes ));
38
- try {
39
- $ ret = parent ::match ($ pathinfo );
40
-
41
- return $ this ->redirect ($ pathinfo , $ ret ['_route ' ] ?? null , $ this ->context ->getScheme ()) + $ ret ;
42
- } catch (ExceptionInterface $ e2 ) {
43
- throw $ e ;
44
- } finally {
45
- $ this ->context ->setScheme ($ scheme );
46
- }
35
+ return $ this ->redirectScheme ($ pathinfo , $ e );
47
36
} elseif ('/ ' === $ pathinfo ) {
48
37
throw $ e ;
49
38
} else {
@@ -54,11 +43,26 @@ public function match($pathinfo)
54
43
return $ this ->redirect ($ pathinfo , $ ret ['_route ' ] ?? null ) + $ ret ;
55
44
} catch (ExceptionInterface $ e2 ) {
56
45
if ($ this ->allowSchemes ) {
57
- goto redirect_scheme ;
46
+ return $ this -> redirectScheme ( $ pathinfo , $ e ) ;
58
47
}
59
48
throw $ e ;
60
49
}
61
50
}
62
51
}
63
52
}
53
+
54
+ private function redirectScheme (string $ pathinfo , ResourceNotFoundException $ originalException )
55
+ {
56
+ $ scheme = $ this ->context ->getScheme ();
57
+ $ this ->context ->setScheme (current ($ this ->allowSchemes ));
58
+ try {
59
+ $ ret = parent ::match ($ pathinfo );
60
+
61
+ return $ this ->redirect ($ pathinfo , $ ret ['_route ' ] ?? null , $ this ->context ->getScheme ()) + $ ret ;
62
+ } catch (ExceptionInterface $ e ) {
63
+ throw $ originalException ;
64
+ } finally {
65
+ $ this ->context ->setScheme ($ scheme );
66
+ }
67
+ }
64
68
}
0 commit comments