Skip to content

Commit cad8035

Browse files
Merge branch '2.8' into 3.4
* 2.8: [travis] cache compiled php extensions fix merge
2 parents 27d0303 + 722db7a commit cad8035

File tree

10 files changed

+23
-32
lines changed

10 files changed

+23
-32
lines changed

Matcher/Dumper/PhpMatcherDumper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public function match(\$rawPathinfo)
104104
\$context = \$this->context;
105105
\$request = \$this->request ?: \$this->createRequest(\$pathinfo);
106106
\$requestMethod = \$canonicalMethod = \$context->getMethod();
107-
\$scheme = \$context->getScheme();
108107
109108
if ('HEAD' === \$requestMethod) {
110109
\$canonicalMethod = 'GET';
@@ -362,7 +361,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
362361
$code .= <<<EOF
363362
if ('/' === substr(\$pathinfo, -1)) {
364363
// no-op
365-
} elseif (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
364+
} elseif ('GET' !== \$canonicalMethod) {
366365
goto $gotoname;
367366
} else {
368367
return array_replace(\$ret, \$this->redirect(\$rawPathinfo.'/', '$name'));
@@ -379,7 +378,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
379378
$schemes = str_replace("\n", '', var_export(array_flip($schemes), true));
380379
$code .= <<<EOF
381380
\$requiredSchemes = $schemes;
382-
if (!isset(\$requiredSchemes[\$scheme])) {
381+
if (!isset(\$requiredSchemes[\$context->getScheme()])) {
383382
return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
384383
}
385384

Tests/Fixtures/dumper/url_matcher0.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';

Tests/Fixtures/dumper/url_matcher1.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';

Tests/Fixtures/dumper/url_matcher2.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';
@@ -84,7 +83,7 @@ public function match($rawPathinfo)
8483
$ret = array('_route' => 'baz3');
8584
if ('/' === substr($pathinfo, -1)) {
8685
// no-op
87-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
86+
} elseif ('GET' !== $canonicalMethod) {
8887
goto not_baz3;
8988
} else {
9089
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3'));
@@ -101,7 +100,7 @@ public function match($rawPathinfo)
101100
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
102101
if ('/' === substr($pathinfo, -1)) {
103102
// no-op
104-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
103+
} elseif ('GET' !== $canonicalMethod) {
105104
goto not_baz4;
106105
} else {
107106
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4'));
@@ -190,7 +189,7 @@ public function match($rawPathinfo)
190189
$ret = array('_route' => 'hey');
191190
if ('/' === substr($pathinfo, -1)) {
192191
// no-op
193-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
192+
} elseif ('GET' !== $canonicalMethod) {
194193
goto not_hey;
195194
} else {
196195
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey'));
@@ -340,7 +339,7 @@ public function match($rawPathinfo)
340339
if ('/secure' === $pathinfo) {
341340
$ret = array('_route' => 'secure');
342341
$requiredSchemes = array ( 'https' => 0,);
343-
if (!isset($requiredSchemes[$scheme])) {
342+
if (!isset($requiredSchemes[$context->getScheme()])) {
344343
return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes)));
345344
}
346345

@@ -351,7 +350,7 @@ public function match($rawPathinfo)
351350
if ('/nonsecure' === $pathinfo) {
352351
$ret = array('_route' => 'nonsecure');
353352
$requiredSchemes = array ( 'http' => 0,);
354-
if (!isset($requiredSchemes[$scheme])) {
353+
if (!isset($requiredSchemes[$context->getScheme()])) {
355354
return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes)));
356355
}
357356

Tests/Fixtures/dumper/url_matcher3.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';

Tests/Fixtures/dumper/url_matcher4.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';

Tests/Fixtures/dumper/url_matcher5.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';
@@ -58,7 +57,7 @@ public function match($rawPathinfo)
5857
$ret = array('_route' => 'a_fourth');
5958
if ('/' === substr($pathinfo, -1)) {
6059
// no-op
61-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
60+
} elseif ('GET' !== $canonicalMethod) {
6261
goto not_a_fourth;
6362
} else {
6463
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth'));
@@ -73,7 +72,7 @@ public function match($rawPathinfo)
7372
$ret = array('_route' => 'a_fifth');
7473
if ('/' === substr($pathinfo, -1)) {
7574
// no-op
76-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
75+
} elseif ('GET' !== $canonicalMethod) {
7776
goto not_a_fifth;
7877
} else {
7978
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth'));
@@ -88,7 +87,7 @@ public function match($rawPathinfo)
8887
$ret = array('_route' => 'a_sixth');
8988
if ('/' === substr($pathinfo, -1)) {
9089
// no-op
91-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
90+
} elseif ('GET' !== $canonicalMethod) {
9291
goto not_a_sixth;
9392
} else {
9493
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth'));
@@ -111,7 +110,7 @@ public function match($rawPathinfo)
111110
$ret = array('_route' => 'nested_a');
112111
if ('/' === substr($pathinfo, -1)) {
113112
// no-op
114-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
113+
} elseif ('GET' !== $canonicalMethod) {
115114
goto not_nested_a;
116115
} else {
117116
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a'));
@@ -126,7 +125,7 @@ public function match($rawPathinfo)
126125
$ret = array('_route' => 'nested_b');
127126
if ('/' === substr($pathinfo, -1)) {
128127
// no-op
129-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
128+
} elseif ('GET' !== $canonicalMethod) {
130129
goto not_nested_b;
131130
} else {
132131
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b'));
@@ -141,7 +140,7 @@ public function match($rawPathinfo)
141140
$ret = array('_route' => 'nested_c');
142141
if ('/' === substr($pathinfo, -1)) {
143142
// no-op
144-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
143+
} elseif ('GET' !== $canonicalMethod) {
145144
goto not_nested_c;
146145
} else {
147146
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c'));
@@ -159,7 +158,7 @@ public function match($rawPathinfo)
159158
$ret = array('_route' => 'slashed_a');
160159
if ('/' === substr($pathinfo, -1)) {
161160
// no-op
162-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
161+
} elseif ('GET' !== $canonicalMethod) {
163162
goto not_slashed_a;
164163
} else {
165164
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a'));
@@ -174,7 +173,7 @@ public function match($rawPathinfo)
174173
$ret = array('_route' => 'slashed_b');
175174
if ('/' === substr($pathinfo, -1)) {
176175
// no-op
177-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
176+
} elseif ('GET' !== $canonicalMethod) {
178177
goto not_slashed_b;
179178
} else {
180179
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b'));
@@ -189,7 +188,7 @@ public function match($rawPathinfo)
189188
$ret = array('_route' => 'slashed_c');
190189
if ('/' === substr($pathinfo, -1)) {
191190
// no-op
192-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
191+
} elseif ('GET' !== $canonicalMethod) {
193192
goto not_slashed_c;
194193
} else {
195194
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c'));

Tests/Fixtures/dumper/url_matcher6.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';

Tests/Fixtures/dumper/url_matcher7.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function match($rawPathinfo)
2323
$context = $this->context;
2424
$request = $this->request ?: $this->createRequest($pathinfo);
2525
$requestMethod = $canonicalMethod = $context->getMethod();
26-
$scheme = $context->getScheme();
2726

2827
if ('HEAD' === $requestMethod) {
2928
$canonicalMethod = 'GET';
@@ -35,7 +34,7 @@ public function match($rawPathinfo)
3534
$ret = array('_route' => 'simple_trailing_slash_no_methods');
3635
if ('/' === substr($pathinfo, -1)) {
3736
// no-op
38-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
37+
} elseif ('GET' !== $canonicalMethod) {
3938
goto not_simple_trailing_slash_no_methods;
4039
} else {
4140
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods'));
@@ -55,7 +54,7 @@ public function match($rawPathinfo)
5554
$ret = array('_route' => 'simple_trailing_slash_GET_method');
5655
if ('/' === substr($pathinfo, -1)) {
5756
// no-op
58-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
57+
} elseif ('GET' !== $canonicalMethod) {
5958
goto not_simple_trailing_slash_GET_method;
6059
} else {
6160
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
@@ -75,7 +74,7 @@ public function match($rawPathinfo)
7574
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
7675
if ('/' === substr($pathinfo, -1)) {
7776
// no-op
78-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
77+
} elseif ('GET' !== $canonicalMethod) {
7978
goto not_simple_trailing_slash_HEAD_method;
8079
} else {
8180
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method'));
@@ -104,7 +103,7 @@ public function match($rawPathinfo)
104103
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
105104
if ('/' === substr($pathinfo, -1)) {
106105
// no-op
107-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
106+
} elseif ('GET' !== $canonicalMethod) {
108107
goto not_regex_trailing_slash_no_methods;
109108
} else {
110109
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods'));
@@ -124,7 +123,7 @@ public function match($rawPathinfo)
124123
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
125124
if ('/' === substr($pathinfo, -1)) {
126125
// no-op
127-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
126+
} elseif ('GET' !== $canonicalMethod) {
128127
goto not_regex_trailing_slash_GET_method;
129128
} else {
130129
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
@@ -144,7 +143,7 @@ public function match($rawPathinfo)
144143
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
145144
if ('/' === substr($pathinfo, -1)) {
146145
// no-op
147-
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
146+
} elseif ('GET' !== $canonicalMethod) {
148147
goto not_regex_trailing_slash_HEAD_method;
149148
} else {
150149
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method'));

Tests/Matcher/UrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public function testNoConfiguration()
435435
{
436436
$coll = new RouteCollection();
437437

438-
$matcher = new UrlMatcher($coll, new RequestContext());
438+
$matcher = $this->getUrlMatcher($coll);
439439
$matcher->match('/');
440440
}
441441

0 commit comments

Comments
 (0)