Skip to content

Commit f5060c1

Browse files
Merge branch '2.8' into 3.4
* 2.8: [travis] cache compiled php extensions fix merge
2 parents c026ec6 + 8ecf01b commit f5060c1

File tree

11 files changed

+45
-36
lines changed

11 files changed

+45
-36
lines changed

.travis.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ cache:
3636
directories:
3737
- .phpunit
3838
- php-$MIN_PHP
39+
- php-ext
3940

4041
services:
4142
- memcached
@@ -110,6 +111,23 @@ before_install:
110111
echo extension = mongo.so >> $INI
111112
fi
112113
114+
# tpecl is a helper to compile and cache php extensions
115+
tpecl () {
116+
local ext_name=$1
117+
local ext_so=$2
118+
local ext_dir=$(php -r "echo ini_get('extension_dir');")
119+
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
120+
121+
if [[ -e $ext_cache/$ext_so ]]; then
122+
echo extension = $ext_cache/$ext_so >> $INI
123+
else
124+
mkdir -p $ext_cache
125+
echo yes | pecl install -f $ext_name &&
126+
cp $ext_dir/$ext_so $ext_cache
127+
fi
128+
}
129+
export -f tpecl
130+
113131
# Matrix lines for intermediate PHP versions are skipped for pull requests
114132
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
115133
deps=skip
@@ -128,11 +146,11 @@ before_install:
128146
- |
129147
# Install extra PHP extensions
130148
if [[ ! $skip && $PHP = 5.* ]]; then
131-
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
132-
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
149+
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
150+
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
133151
elif [[ ! $skip && $PHP = 7.* ]]; then
134-
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
135-
tfold ext.mongodb pecl install -f mongodb-1.4.0RC1
152+
tfold ext.apcu tpecl apcu-5.1.6 apcu.so
153+
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
136154
fi
137155
138156
- |

src/Symfony/Component/Routing/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

src/Symfony/Component/Routing/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';

src/Symfony/Component/Routing/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';

src/Symfony/Component/Routing/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

src/Symfony/Component/Routing/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';

src/Symfony/Component/Routing/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';

src/Symfony/Component/Routing/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'));

src/Symfony/Component/Routing/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';

src/Symfony/Component/Routing/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'));

0 commit comments

Comments
 (0)