Merge branch '2.8' into 3.4

* 2.8:
  [travis] cache compiled php extensions
  fix merge
This commit is contained in:
Nicolas Grekas 2018-02-04 13:55:34 +01:00
commit f5060c122b
11 changed files with 45 additions and 36 deletions

View File

@ -36,6 +36,7 @@ cache:
directories:
- .phpunit
- php-$MIN_PHP
- php-ext
services:
- memcached
@ -110,6 +111,23 @@ before_install:
echo extension = mongo.so >> $INI
fi
# tpecl is a helper to compile and cache php extensions
tpecl () {
local ext_name=$1
local ext_so=$2
local ext_dir=$(php -r "echo ini_get('extension_dir');")
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
if [[ -e $ext_cache/$ext_so ]]; then
echo extension = $ext_cache/$ext_so >> $INI
else
mkdir -p $ext_cache
echo yes | pecl install -f $ext_name &&
cp $ext_dir/$ext_so $ext_cache
fi
}
export -f tpecl
# Matrix lines for intermediate PHP versions are skipped for pull requests
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
deps=skip
@ -128,11 +146,11 @@ before_install:
- |
# Install extra PHP extensions
if [[ ! $skip && $PHP = 5.* ]]; then
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
elif [[ ! $skip && $PHP = 7.* ]]; then
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
tfold ext.mongodb pecl install -f mongodb-1.4.0RC1
tfold ext.apcu tpecl apcu-5.1.6 apcu.so
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
fi
- |

View File

@ -104,7 +104,6 @@ EOF;
\$context = \$this->context;
\$request = \$this->request ?: \$this->createRequest(\$pathinfo);
\$requestMethod = \$canonicalMethod = \$context->getMethod();
\$scheme = \$context->getScheme();
if ('HEAD' === \$requestMethod) {
\$canonicalMethod = 'GET';
@ -362,7 +361,7 @@ EOF;
$code .= <<<EOF
if ('/' === substr(\$pathinfo, -1)) {
// no-op
} elseif (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== \$canonicalMethod) {
goto $gotoname;
} else {
return array_replace(\$ret, \$this->redirect(\$rawPathinfo.'/', '$name'));
@ -379,7 +378,7 @@ EOF;
$schemes = str_replace("\n", '', var_export(array_flip($schemes), true));
$code .= <<<EOF
\$requiredSchemes = $schemes;
if (!isset(\$requiredSchemes[\$scheme])) {
if (!isset(\$requiredSchemes[\$context->getScheme()])) {
return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
}

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
@ -84,7 +83,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'baz3');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_baz3;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3'));
@ -101,7 +100,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_baz4;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4'));
@ -190,7 +189,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'hey');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_hey;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey'));
@ -340,7 +339,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/secure' === $pathinfo) {
$ret = array('_route' => 'secure');
$requiredSchemes = array ( 'https' => 0,);
if (!isset($requiredSchemes[$scheme])) {
if (!isset($requiredSchemes[$context->getScheme()])) {
return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes)));
}
@ -351,7 +350,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/nonsecure' === $pathinfo) {
$ret = array('_route' => 'nonsecure');
$requiredSchemes = array ( 'http' => 0,);
if (!isset($requiredSchemes[$scheme])) {
if (!isset($requiredSchemes[$context->getScheme()])) {
return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes)));
}

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
@ -58,7 +57,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'a_fourth');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_a_fourth;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth'));
@ -73,7 +72,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'a_fifth');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_a_fifth;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth'));
@ -88,7 +87,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'a_sixth');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_a_sixth;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth'));
@ -111,7 +110,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'nested_a');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_nested_a;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a'));
@ -126,7 +125,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'nested_b');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_nested_b;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b'));
@ -141,7 +140,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'nested_c');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_nested_c;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c'));
@ -159,7 +158,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'slashed_a');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_slashed_a;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a'));
@ -174,7 +173,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'slashed_b');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_slashed_b;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b'));
@ -189,7 +188,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'slashed_c');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_slashed_c;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c'));

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';

View File

@ -23,7 +23,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$context = $this->context;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
@ -35,7 +34,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'simple_trailing_slash_no_methods');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_simple_trailing_slash_no_methods;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods'));
@ -55,7 +54,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'simple_trailing_slash_GET_method');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_simple_trailing_slash_GET_method;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
@ -75,7 +74,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_simple_trailing_slash_HEAD_method;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method'));
@ -104,7 +103,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_regex_trailing_slash_no_methods;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods'));
@ -124,7 +123,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_regex_trailing_slash_GET_method;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
@ -144,7 +143,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
} elseif ('GET' !== $canonicalMethod) {
goto not_regex_trailing_slash_HEAD_method;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method'));

View File

@ -435,7 +435,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$matcher = new UrlMatcher($coll, new RequestContext());
$matcher = $this->getUrlMatcher($coll);
$matcher->match('/');
}