Merge branch '4.3' into 4.4

* 4.3:
  [Intl] Improve the error message when country code is wrong
  Fix tests
  [Intl][4.3] Cleanup internal api
  [HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping
  bumped Symfony version to 4.2.10
  updated VERSION for 4.2.9
  updated CHANGELOG for 4.2.9
  Use AsserEquals for floating-point values
This commit is contained in:
Nicolas Grekas 2019-05-29 20:10:53 +02:00
commit 5af3e54d2b
11 changed files with 91 additions and 32 deletions

View File

@ -7,6 +7,35 @@ in 4.2 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.2.0...v4.2.1
* 4.2.9 (2019-05-28)
* bug #31584 [Workflow] Do not trigger extra guards (lyrixx)
* bug #31632 [Messenger] Use "real" memory usage to honor --memory-limit (chalasr)
* bug #31599 [Translation] Fixed issue with new vs old TranslatorInterface in TranslationDataCollector (althaus)
* bug #31349 [WebProfilerBundle] Use absolute URL for profiler links (Alumbrados)
* bug #31541 [DI] fix using bindings with locators of service subscribers (nicolas-grekas)
* bug #31568 [Process] Fix infinite waiting for stopped process (mshavliuk)
* bug #31551 [ProxyManager] isProxyCandidate() does not take into account interfaces (andrerom)
* bug #31335 [Doctrine] Respect parent class contract in ContainerAwareEventManager (Koc)
* bug #31421 [Routing][AnnotationClassLoader] fix utf-8 encoding in default route name (przemyslaw-bogusz)
* bug #31510 Use the current working dir as default first arg in 'link' binary (lyrixx)
* bug #31524 [HttpFoundation] prevent deprecation when filesize matches error code (xabbuh)
* bug #31535 [Debug] Wrap call to require_once in a try/catch (lyrixx)
* bug #31477 [PropertyAccess] Add missing property to PropertyAccessor (vudaltsov)
* bug #31479 [Cache] fix saving unrelated keys in recursive callback calls (nicolas-grekas)
* bug #31438 [Serializer] Fix denormalization of object with variadic constructor typed argument (ajgarlag)
* bug #31445 [Messenger] Making cache rebuild correctly when message subscribers change (weaverryan)
* bug #31442 [Validator] Fix finding translator parent definition in compiler pass (deguif)
* bug #31475 [HttpFoundation] Allow set 'None' on samesite cookie flag (markitosgv)
* bug #31456 Remove deprecated usage of some Twig features (fabpot)
* bug #31207 [Routing] Fixed unexpected 404 NoConfigurationException (yceruto)
* bug #31261 [Console] Commands with an alias should not be recognized as ambiguous when using register (Simperfit)
* bug #31371 [DI] Removes number of elements information in debug mode (jschaedl)
* bug #31418 [FrameworkBundle] clarify the possible class/interface of the cache (xabbuh)
* bug #31411 [Intl] Fix root fallback locale (ro0NL)
* bug #31377 [Console] Fix auto-complete for ChoiceQuestion (multi-select answers) (battye)
* bug #31380 [WebProfilerBundle] Don't filter submitted IP values (javiereguiluz)
* 4.2.8 (2019-05-01)
* bug #31338 Revert "bug #30620 [FrameworkBundle][HttpFoundation] make session service resettable (dmaicher)" (nicolas-grekas)

View File

@ -122,6 +122,17 @@ class TimezoneTypeTest extends BaseTypeTest
*/
public function testIntlTimeZoneInputWithBc()
{
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
}
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone']);
$form->submit('Europe/Saratov');
@ -134,6 +145,17 @@ class TimezoneTypeTest extends BaseTypeTest
*/
public function testIntlTimeZoneInputWithBcAndIntl()
{
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
}
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone', 'intl' => true]);
$form->submit('Europe/Saratov');

View File

@ -223,12 +223,17 @@ class BinaryFileResponse extends Response
list($pathPrefix, $location) = $part;
if (substr($path, 0, \strlen($pathPrefix)) === $pathPrefix) {
$path = $location.substr($path, \strlen($pathPrefix));
// Only set X-Accel-Redirect header if a valid URI can be produced
// as nginx does not serve arbitrary file paths.
$this->headers->set($type, $path);
$this->maxlen = 0;
break;
}
}
} else {
$this->headers->set($type, $path);
$this->maxlen = 0;
}
$this->headers->set($type, $path);
$this->maxlen = 0;
} elseif ($request->headers->has('Range')) {
// Process the range headers.
if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) {

View File

@ -339,6 +339,7 @@ class BinaryFileResponseTest extends ResponseTestCase
['/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'],
['/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'],
['/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'],
['/tmp/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', null],
];
}

View File

@ -43,7 +43,8 @@ class JsonResponseTest extends TestCase
$this->assertSame('0', $response->getContent());
$response = new JsonResponse(0.1);
$this->assertSame('0.1', $response->getContent());
$this->assertEquals('0.1', $response->getContent());
$this->assertInternalType('string', $response->getContent());
$response = new JsonResponse(true);
$this->assertSame('true', $response->getContent());
@ -131,7 +132,8 @@ class JsonResponseTest extends TestCase
$response = JsonResponse::create(0.1);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertSame('0.1', $response->getContent());
$this->assertEquals('0.1', $response->getContent());
$this->assertInternalType('string', $response->getContent());
$response = JsonResponse::create(true);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);

View File

@ -18,7 +18,7 @@ use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @internal
* @internal to be removed in 5.0.
*/
class LanguageDataProvider
{
@ -37,17 +37,11 @@ class LanguageDataProvider
$this->reader = $reader;
}
/**
* @internal to be removed in 5.0.
*/
public function getLanguages()
{
return $this->reader->readEntry($this->path, 'meta', ['Languages']);
}
/**
* @internal to be removed in 5.0.
*/
public function getAliases()
{
return $this->reader->readEntry($this->path, 'root', ['Aliases']);
@ -62,9 +56,6 @@ class LanguageDataProvider
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $language]);
}
/**
* @internal to be removed in 5.0.
*/
public function getNames($displayLocale = null)
{
if (null === $displayLocale) {
@ -83,9 +74,6 @@ class LanguageDataProvider
return $languages;
}
/**
* @internal to be removed in 5.0.
*/
public function getAlpha3Code($language)
{
return $this->reader->readEntry($this->path, 'meta', ['Alpha2ToAlpha3', $language]);

View File

@ -18,7 +18,7 @@ use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @internal
* @internal to be removed in 5.0.
*/
class RegionDataProvider
{
@ -37,9 +37,6 @@ class RegionDataProvider
$this->reader = $reader;
}
/**
* @internal to be removed in 5.0.
*/
public function getRegions()
{
return $this->reader->readEntry($this->path, 'meta', ['Regions']);
@ -54,9 +51,6 @@ class RegionDataProvider
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $region]);
}
/**
* @internal to be removed in 5.0.
*/
public function getNames($displayLocale = null)
{
if (null === $displayLocale) {

View File

@ -18,7 +18,7 @@ use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @internal
* @internal to be removed in 5.0.
*/
class ScriptDataProvider
{
@ -37,9 +37,6 @@ class ScriptDataProvider
$this->reader = $reader;
}
/**
* @internal to be removed in 5.0.
*/
public function getScripts()
{
return $this->reader->readEntry($this->path, 'meta', ['Scripts']);
@ -54,9 +51,6 @@ class ScriptDataProvider
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $script]);
}
/**
* @internal to be removed in 5.0.
*/
public function getNames($displayLocale = null)
{
if (null === $displayLocale) {

View File

@ -603,6 +603,15 @@ class TimezonesTest extends ResourceBundleTestCase
Timezones::forCountryCode('foobar');
}
/**
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
* @expectedExceptionMessage Country codes must be in uppercase, but "nl" was passed. Try with "NL" country code instead.
*/
public function testForCountryCodeWithWrongCountryCode()
{
Timezones::forCountryCode('nl');
}
/**
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
*/

View File

@ -109,6 +109,10 @@ final class Timezones extends ResourceBundle
return [];
}
if (Countries::exists(strtoupper($country))) {
throw new MissingResourceException(sprintf('Country codes must be in uppercase, but "%s" was passed. Try with "%s" country code instead.', $country, strtoupper($country)));
}
throw $e;
}
}

View File

@ -76,7 +76,7 @@ class TimezoneValidatorTest extends ConstraintValidatorTestCase
yield ['PST8PDT'];
yield ['America/Montreal'];
// expired in ICU
// previously expired in ICU
yield ['Europe/Saratov'];
// standard
@ -316,6 +316,17 @@ class TimezoneValidatorTest extends ConstraintValidatorTestCase
*/
public function testIntlCompatibility()
{
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
}
$constraint = new Timezone([
'message' => 'myMessage',
'intlCompatible' => true,