Merge branch '3.4' into 4.3
* 3.4: [FrameworkBundle] Detect indirect env vars in routing Remove calls to deprecated function assertAttributeX [Intl] Order alpha2 to alpha3 mapping [Routing] added a warning about the getRouteCollection() method Allow sutFqcnResolver to return array [HttpFoundation] Revert getClientIp @return docblock
This commit is contained in:
commit
16a4620d1f
@ -76,7 +76,7 @@ class CoverageListenerTrait
|
||||
$cache = $r->getValue();
|
||||
$cache = array_replace_recursive($cache, array(
|
||||
\get_class($test) => array(
|
||||
'covers' => array($sutFqcn),
|
||||
'covers' => \is_array($sutFqcn) ? $sutFqcn : array($sutFqcn),
|
||||
),
|
||||
));
|
||||
$r->setValue($testClass, $cache);
|
||||
|
@ -160,7 +160,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
||||
return '%%';
|
||||
}
|
||||
|
||||
if (preg_match('/^env\(\w+\)$/', $match[1])) {
|
||||
if (preg_match('/^env\((?:\w++:)*+\w++\)$/', $match[1])) {
|
||||
throw new RuntimeException(sprintf('Using "%%%s%%" is not allowed in routing configuration.', $match[1]));
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
||||
if (\is_string($resolved) || is_numeric($resolved)) {
|
||||
$this->collectedParameters[$match[1]] = $resolved;
|
||||
|
||||
return (string) $resolved;
|
||||
return (string) $this->resolve($resolved);
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved)));
|
||||
|
@ -16,6 +16,7 @@ use Psr\Container\ContainerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Routing\Router;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
@ -278,13 +279,13 @@ class RouterTest extends TestCase
|
||||
$routes->add('foo', new Route('/before/%parameter.foo%/after/%%escaped%%'));
|
||||
|
||||
$sc = $this->getServiceContainer($routes);
|
||||
$sc->setParameter('parameter.foo', 'foo');
|
||||
$sc->setParameter('parameter.foo', 'foo-%%escaped%%');
|
||||
|
||||
$router = new Router($sc, 'foo');
|
||||
$route = $router->getRouteCollection()->get('foo');
|
||||
|
||||
$this->assertEquals(
|
||||
'/before/foo/after/%escaped%',
|
||||
'/before/foo-%escaped%/after/%escaped%',
|
||||
$route->getPath()
|
||||
);
|
||||
}
|
||||
@ -313,6 +314,22 @@ class RouterTest extends TestCase
|
||||
$router->getRouteCollection();
|
||||
}
|
||||
|
||||
public function testIndirectEnvPlaceholders()
|
||||
{
|
||||
$routes = new RouteCollection();
|
||||
|
||||
$routes->add('foo', new Route('/%foo%'));
|
||||
|
||||
$router = new Router($container = $this->getServiceContainer($routes), 'foo');
|
||||
$container->setParameter('foo', 'foo-%bar%');
|
||||
$container->setParameter('bar', '%env(string:FOO)%');
|
||||
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Using "%env(string:FOO)%" is not allowed in routing configuration.');
|
||||
|
||||
$router->getRouteCollection();
|
||||
}
|
||||
|
||||
public function testHostPlaceholders()
|
||||
{
|
||||
$routes = new RouteCollection();
|
||||
|
@ -61,14 +61,14 @@ class GenericEventTest extends TestCase
|
||||
public function testSetArguments()
|
||||
{
|
||||
$result = $this->event->setArguments(['foo' => 'bar']);
|
||||
$this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event);
|
||||
$this->assertSame(['foo' => 'bar'], $this->event->getArguments());
|
||||
$this->assertSame($this->event, $result);
|
||||
}
|
||||
|
||||
public function testSetArgument()
|
||||
{
|
||||
$result = $this->event->setArgument('foo2', 'bar2');
|
||||
$this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
|
||||
$this->assertSame(['name' => 'Event', 'foo2' => 'bar2'], $this->event->getArguments());
|
||||
$this->assertEquals($this->event, $result);
|
||||
}
|
||||
|
||||
@ -97,13 +97,13 @@ class GenericEventTest extends TestCase
|
||||
public function testOffsetSet()
|
||||
{
|
||||
$this->event['foo2'] = 'bar2';
|
||||
$this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
|
||||
$this->assertSame(['name' => 'Event', 'foo2' => 'bar2'], $this->event->getArguments());
|
||||
}
|
||||
|
||||
public function testOffsetUnset()
|
||||
{
|
||||
unset($this->event['name']);
|
||||
$this->assertAttributeSame([], 'arguments', $this->event);
|
||||
$this->assertSame([], $this->event->getArguments());
|
||||
}
|
||||
|
||||
public function testOffsetIsset()
|
||||
|
@ -792,7 +792,11 @@ class Request
|
||||
* being the original client, and each successive proxy that passed the request
|
||||
* adding the IP address where it received the request from.
|
||||
*
|
||||
* @return string|null The client IP address
|
||||
* If your reverse proxy uses a different header name than "X-Forwarded-For",
|
||||
* ("Client-Ip" for instance), configure it via the $trustedHeaderSet
|
||||
* argument of the Request::setTrustedProxies() method instead.
|
||||
*
|
||||
* @return string The client IP address
|
||||
*
|
||||
* @see getClientIps()
|
||||
* @see http://en.wikipedia.org/wiki/X-Forwarded-For
|
||||
|
@ -317,15 +317,15 @@ class PdoSessionHandlerTest extends TestCase
|
||||
public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null)
|
||||
{
|
||||
$storage = new PdoSessionHandler($url);
|
||||
$reflection = new \ReflectionClass(PdoSessionHandler::class);
|
||||
|
||||
$this->assertAttributeEquals($expectedDsn, 'dsn', $storage);
|
||||
|
||||
if (null !== $expectedUser) {
|
||||
$this->assertAttributeEquals($expectedUser, 'username', $storage);
|
||||
}
|
||||
|
||||
if (null !== $expectedPassword) {
|
||||
$this->assertAttributeEquals($expectedPassword, 'password', $storage);
|
||||
foreach (['dsn' => $expectedDsn, 'username' => $expectedUser, 'password' => $expectedPassword] as $property => $expectedValue) {
|
||||
if (!isset($expectedValue)) {
|
||||
continue;
|
||||
}
|
||||
$property = $reflection->getProperty($property);
|
||||
$property->setAccessible(true);
|
||||
$this->assertSame($expectedValue, $property->getValue($storage));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,6 +204,8 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||
}
|
||||
}
|
||||
|
||||
asort($alpha2ToAlpha3);
|
||||
|
||||
return $alpha2ToAlpha3;
|
||||
}
|
||||
}
|
||||
|
@ -623,14 +623,11 @@
|
||||
"Alpha2ToAlpha3": {
|
||||
"aa": "aar",
|
||||
"ab": "abk",
|
||||
"dz": "dzo",
|
||||
"af": "afr",
|
||||
"ak": "aka",
|
||||
"sq": "sqi",
|
||||
"am": "amh",
|
||||
"ar": "ara",
|
||||
"an": "arg",
|
||||
"hy": "hye",
|
||||
"as": "asm",
|
||||
"av": "ava",
|
||||
"ae": "ave",
|
||||
@ -638,7 +635,6 @@
|
||||
"az": "aze",
|
||||
"ba": "bak",
|
||||
"bm": "bam",
|
||||
"eu": "eus",
|
||||
"be": "bel",
|
||||
"bn": "ben",
|
||||
"bi": "bis",
|
||||
@ -646,12 +642,10 @@
|
||||
"bs": "bos",
|
||||
"br": "bre",
|
||||
"bg": "bul",
|
||||
"my": "mya",
|
||||
"ca": "cat",
|
||||
"cs": "ces",
|
||||
"ch": "cha",
|
||||
"ce": "che",
|
||||
"zh": "zho",
|
||||
"cu": "chu",
|
||||
"cv": "chv",
|
||||
"kw": "cor",
|
||||
@ -661,13 +655,12 @@
|
||||
"da": "dan",
|
||||
"de": "deu",
|
||||
"dv": "div",
|
||||
"mn": "mon",
|
||||
"nl": "nld",
|
||||
"et": "est",
|
||||
"dz": "dzo",
|
||||
"el": "ell",
|
||||
"en": "eng",
|
||||
"eo": "epo",
|
||||
"ik": "ipk",
|
||||
"et": "est",
|
||||
"eu": "eus",
|
||||
"ee": "ewe",
|
||||
"fo": "fao",
|
||||
"fa": "fas",
|
||||
@ -676,8 +669,6 @@
|
||||
"fr": "fra",
|
||||
"fy": "fry",
|
||||
"ff": "ful",
|
||||
"om": "orm",
|
||||
"ka": "kat",
|
||||
"gd": "gla",
|
||||
"ga": "gle",
|
||||
"gl": "glg",
|
||||
@ -692,31 +683,34 @@
|
||||
"ho": "hmo",
|
||||
"hr": "hrv",
|
||||
"hu": "hun",
|
||||
"hy": "hye",
|
||||
"ig": "ibo",
|
||||
"is": "isl",
|
||||
"io": "ido",
|
||||
"ii": "iii",
|
||||
"iu": "iku",
|
||||
"ie": "ile",
|
||||
"ia": "ina",
|
||||
"id": "ind",
|
||||
"ik": "ipk",
|
||||
"is": "isl",
|
||||
"it": "ita",
|
||||
"jv": "jav",
|
||||
"ja": "jpn",
|
||||
"kl": "kal",
|
||||
"kn": "kan",
|
||||
"ks": "kas",
|
||||
"ka": "kat",
|
||||
"kr": "kau",
|
||||
"kk": "kaz",
|
||||
"km": "khm",
|
||||
"ki": "kik",
|
||||
"rw": "kin",
|
||||
"ky": "kir",
|
||||
"ku": "kur",
|
||||
"kg": "kon",
|
||||
"kv": "kom",
|
||||
"kg": "kon",
|
||||
"ko": "kor",
|
||||
"kj": "kua",
|
||||
"ku": "kur",
|
||||
"lo": "lao",
|
||||
"la": "lat",
|
||||
"lv": "lav",
|
||||
@ -726,40 +720,43 @@
|
||||
"lb": "ltz",
|
||||
"lu": "lub",
|
||||
"lg": "lug",
|
||||
"mk": "mkd",
|
||||
"mh": "mah",
|
||||
"ml": "mal",
|
||||
"mi": "mri",
|
||||
"mr": "mar",
|
||||
"ms": "msa",
|
||||
"mk": "mkd",
|
||||
"mg": "mlg",
|
||||
"mt": "mlt",
|
||||
"ro": "ron",
|
||||
"mn": "mon",
|
||||
"mi": "mri",
|
||||
"ms": "msa",
|
||||
"my": "mya",
|
||||
"na": "nau",
|
||||
"nv": "nav",
|
||||
"nr": "nbl",
|
||||
"nd": "nde",
|
||||
"ng": "ndo",
|
||||
"ne": "nep",
|
||||
"nl": "nld",
|
||||
"nn": "nno",
|
||||
"nb": "nob",
|
||||
"ny": "nya",
|
||||
"oc": "oci",
|
||||
"oj": "oji",
|
||||
"or": "ori",
|
||||
"om": "orm",
|
||||
"os": "oss",
|
||||
"pa": "pan",
|
||||
"ps": "pus",
|
||||
"pi": "pli",
|
||||
"pl": "pol",
|
||||
"pt": "por",
|
||||
"ps": "pus",
|
||||
"qu": "que",
|
||||
"rm": "roh",
|
||||
"ro": "ron",
|
||||
"rn": "run",
|
||||
"ru": "rus",
|
||||
"sg": "sag",
|
||||
"sa": "san",
|
||||
"sr": "srp",
|
||||
"si": "sin",
|
||||
"sk": "slk",
|
||||
"sl": "slv",
|
||||
@ -770,7 +767,9 @@
|
||||
"so": "som",
|
||||
"st": "sot",
|
||||
"es": "spa",
|
||||
"sq": "sqi",
|
||||
"sc": "srd",
|
||||
"sr": "srp",
|
||||
"ss": "ssw",
|
||||
"su": "sun",
|
||||
"sw": "swa",
|
||||
@ -800,6 +799,7 @@
|
||||
"yi": "yid",
|
||||
"yo": "yor",
|
||||
"za": "zha",
|
||||
"zh": "zho",
|
||||
"zu": "zul"
|
||||
}
|
||||
}
|
||||
|
@ -648,11 +648,9 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'ab' => 'abk',
|
||||
'af' => 'afr',
|
||||
'ak' => 'aka',
|
||||
'sq' => 'sqi',
|
||||
'am' => 'amh',
|
||||
'ar' => 'ara',
|
||||
'an' => 'arg',
|
||||
'hy' => 'hye',
|
||||
'as' => 'asm',
|
||||
'av' => 'ava',
|
||||
'ae' => 'ave',
|
||||
@ -660,7 +658,6 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'az' => 'aze',
|
||||
'ba' => 'bak',
|
||||
'bm' => 'bam',
|
||||
'eu' => 'eus',
|
||||
'be' => 'bel',
|
||||
'bn' => 'ben',
|
||||
'bi' => 'bis',
|
||||
@ -668,12 +665,10 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'bs' => 'bos',
|
||||
'br' => 'bre',
|
||||
'bg' => 'bul',
|
||||
'my' => 'mya',
|
||||
'ca' => 'cat',
|
||||
'cs' => 'ces',
|
||||
'ch' => 'cha',
|
||||
'ce' => 'che',
|
||||
'zh' => 'zho',
|
||||
'cu' => 'chu',
|
||||
'cv' => 'chv',
|
||||
'kw' => 'cor',
|
||||
@ -683,13 +678,12 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'da' => 'dan',
|
||||
'de' => 'deu',
|
||||
'dv' => 'div',
|
||||
'nl' => 'nld',
|
||||
'dz' => 'dzo',
|
||||
'et' => 'est',
|
||||
'el' => 'ell',
|
||||
'en' => 'eng',
|
||||
'eo' => 'epo',
|
||||
'ik' => 'ipk',
|
||||
'et' => 'est',
|
||||
'eu' => 'eus',
|
||||
'ee' => 'ewe',
|
||||
'fo' => 'fao',
|
||||
'fa' => 'fas',
|
||||
@ -698,8 +692,6 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'fr' => 'fra',
|
||||
'fy' => 'fry',
|
||||
'ff' => 'ful',
|
||||
'om' => 'orm',
|
||||
'ka' => 'kat',
|
||||
'gd' => 'gla',
|
||||
'ga' => 'gle',
|
||||
'gl' => 'glg',
|
||||
@ -714,32 +706,34 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'ho' => 'hmo',
|
||||
'hr' => 'hrv',
|
||||
'hu' => 'hun',
|
||||
'hy' => 'hye',
|
||||
'ig' => 'ibo',
|
||||
'is' => 'isl',
|
||||
'io' => 'ido',
|
||||
'ii' => 'iii',
|
||||
'iu' => 'iku',
|
||||
'ie' => 'ile',
|
||||
'ia' => 'ina',
|
||||
'id' => 'ind',
|
||||
'ik' => 'ipk',
|
||||
'is' => 'isl',
|
||||
'it' => 'ita',
|
||||
'jv' => 'jav',
|
||||
'ja' => 'jpn',
|
||||
'kl' => 'kal',
|
||||
'kn' => 'kan',
|
||||
'ks' => 'kas',
|
||||
'ka' => 'kat',
|
||||
'kr' => 'kau',
|
||||
'kk' => 'kaz',
|
||||
'mn' => 'mon',
|
||||
'km' => 'khm',
|
||||
'ki' => 'kik',
|
||||
'rw' => 'kin',
|
||||
'ky' => 'kir',
|
||||
'ku' => 'kur',
|
||||
'kg' => 'kon',
|
||||
'kv' => 'kom',
|
||||
'kg' => 'kon',
|
||||
'ko' => 'kor',
|
||||
'kj' => 'kua',
|
||||
'ku' => 'kur',
|
||||
'lo' => 'lao',
|
||||
'la' => 'lat',
|
||||
'lv' => 'lav',
|
||||
@ -749,32 +743,36 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'lb' => 'ltz',
|
||||
'lu' => 'lub',
|
||||
'lg' => 'lug',
|
||||
'mk' => 'mkd',
|
||||
'mh' => 'mah',
|
||||
'ml' => 'mal',
|
||||
'mi' => 'mri',
|
||||
'mr' => 'mar',
|
||||
'ms' => 'msa',
|
||||
'mk' => 'mkd',
|
||||
'mg' => 'mlg',
|
||||
'mt' => 'mlt',
|
||||
'mn' => 'mon',
|
||||
'mi' => 'mri',
|
||||
'ms' => 'msa',
|
||||
'my' => 'mya',
|
||||
'na' => 'nau',
|
||||
'nv' => 'nav',
|
||||
'nr' => 'nbl',
|
||||
'nd' => 'nde',
|
||||
'ng' => 'ndo',
|
||||
'ne' => 'nep',
|
||||
'nl' => 'nld',
|
||||
'nn' => 'nno',
|
||||
'nb' => 'nob',
|
||||
'ny' => 'nya',
|
||||
'oc' => 'oci',
|
||||
'oj' => 'oji',
|
||||
'or' => 'ori',
|
||||
'om' => 'orm',
|
||||
'os' => 'oss',
|
||||
'pa' => 'pan',
|
||||
'ps' => 'pus',
|
||||
'pi' => 'pli',
|
||||
'pl' => 'pol',
|
||||
'pt' => 'por',
|
||||
'ps' => 'pus',
|
||||
'qu' => 'que',
|
||||
'rm' => 'roh',
|
||||
'ro' => 'ron',
|
||||
@ -782,7 +780,6 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'ru' => 'rus',
|
||||
'sg' => 'sag',
|
||||
'sa' => 'san',
|
||||
'sr' => 'srp',
|
||||
'si' => 'sin',
|
||||
'sk' => 'slk',
|
||||
'sl' => 'slv',
|
||||
@ -793,7 +790,9 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'so' => 'som',
|
||||
'st' => 'sot',
|
||||
'es' => 'spa',
|
||||
'sq' => 'sqi',
|
||||
'sc' => 'srd',
|
||||
'sr' => 'srp',
|
||||
'ss' => 'ssw',
|
||||
'su' => 'sun',
|
||||
'sw' => 'swa',
|
||||
@ -823,6 +822,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
||||
'yi' => 'yid',
|
||||
'yo' => 'yor',
|
||||
'za' => 'zha',
|
||||
'zh' => 'zho',
|
||||
'zu' => 'zul',
|
||||
];
|
||||
|
||||
|
@ -26,6 +26,9 @@ interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface
|
||||
/**
|
||||
* Gets the RouteCollection instance associated with this Router.
|
||||
*
|
||||
* WARNING: This method should never be used at runtime as it is SLOW.
|
||||
* You might use it in a cache warmer though.
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*/
|
||||
public function getRouteCollection();
|
||||
|
Reference in New Issue
Block a user