Skip to content

Commit 0537e03

Browse files
author
Robin Chalas
committed
Merge branch '3.4'
* 3.4: (38 commits) Fix merge [Lock] Expose an expiringDate and isExpired method in Lock [VarDumper] fix DateCasterTest [config] Add ability to deprecate a node feature symfony#22382 [config] Add abbitily to deprecate a node (Nyholm, fabpot, sanpii) Fix segfault in period caster Create an interface for TranslationReader and moved TranslationLoader to Translation component Always require symfony/polyfill-apcu to provide APCuIterator everywhere [Lock] Fix some tests that require pcntl_sigwaitinfo() function bumped Symfony version to 3.3.9 updated VERSION for 3.3.8 updated CHANGELOG for 3.3.8 [DI] Fix tracking env var placeholders nested in object graphs bumped Symfony version to 3.3.8 updated VERSION for 3.3.7 updated CHANGELOG for 3.3.7 Add period caster [DI] improve psr4-based service discovery with namespace option [DI] Fix tracking env vars when merging configs (bis) removed obsolete comment ...
2 parents 84bde03 + b9fc357 commit 0537e03

File tree

66 files changed

+842
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+842
-202
lines changed

.travis.yml

+28-5
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,38 @@ before_install:
5050
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
5151
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
5252
53+
nanoseconds() {
54+
local cmd="date"
55+
local format="+%s%N"
56+
local os=$(uname)
57+
if hash gdate > /dev/null 2>&1; then
58+
cmd="gdate"
59+
elif [[ "$os" = Darwin ]]; then
60+
format="+%s000000000"
61+
fi
62+
$cmd -u $format
63+
}
64+
export -f nanoseconds
65+
5366
# tfold is a helper to create folded reports
5467
tfold () {
55-
title=$1
56-
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
68+
local title=$1
69+
local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
5770
shift
58-
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
59-
bash -xc "$*" 2>&1 &&
71+
local id=$(printf %08x $(( RANDOM * RANDOM )))
72+
local start=$(nanoseconds)
73+
echo -e "travis_fold:start:$fold"
74+
echo -e "travis_time:start:$id"
75+
echo -e "\\e[1;34m$title\\e[0m"
76+
77+
bash -xc "$*" 2>&1
78+
local ok=$?
79+
local end=$(nanoseconds)
80+
echo -e "\\ntravis_time:end:$id:start=$start,finish=$end,duration=$(($end-$start))"
81+
(exit $ok) &&
6082
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
61-
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
83+
echo -e "\\e[41mKO\\e[0m $title\\n"
84+
(exit $ok)
6285
}
6386
export -f tfold
6487

CHANGELOG-3.3.md

+44
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,50 @@ in 3.3 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1
99

10+
* 3.3.8 (2017-08-28)
11+
12+
* bug #24016 [DI] Fix tracking env var placeholders nested in object graphs (nicolas-grekas)
13+
14+
* 3.3.7 (2017-08-28)
15+
16+
* bug #24009 [DI] Fix tracking env vars when merging configs (bis) (nicolas-grekas)
17+
* bug #23952 [PhpUnitBridge] install PHPUnit 6 on PHP 7.2 (xabbuh)
18+
* bug #23985 [Cache] Workaround zend.detect_unicode + zend.multibyte (nicolas-grekas)
19+
* bug #23989 [Debug] Remove false-positive check in DebugClassLoader (nicolas-grekas)
20+
* bug #23983 [VarDumper] Strengthen dumped JS (nicolas-grekas)
21+
* bug #23982 [VarDumper] Strengthen dumped JS (nicolas-grekas)
22+
* bug #23925 [Validator] Fix use of GroupSequenceProvider in child classes (linniksa)
23+
* bug #23971 [Cache] Fix lazy Memcached connections (nicolas-grekas)
24+
* bug #23970 [Cache] Fix >30 days expirations with Memcached (nicolas-grekas)
25+
* bug #23949 [Dotenv] Get env using $_SERVER to work with fastcgi_param and workaround thread safety issues (nicolas-grekas)
26+
* bug #23799 [Dotenv][WebServerBundle] Override previously loaded variables (voronkovich)
27+
* bug #23676 [WebProfilerBundle] Re add missing link to the controller (lyrixx)
28+
* bug #23870 [DI] Use GlobResource for non-tracked directories (vudaltsov)
29+
* bug #23945 [Validator] Fix Greek translation (azhurb)
30+
* bug #23940 [DI] Fix resolving env vars when compiling a ContainerBuilder (nicolas-grekas)
31+
* bug #23903 [DI] Fix merging of env vars in configs (nicolas-grekas)
32+
* bug #23825 Revert "feature #21038 [FrameworkBundle] deprecated cache:clear with warmup (fabpot)" (nicolas-grekas)
33+
* bug #23899 [DI] Fix reading env vars from fastcgi params (nicolas-grekas)
34+
* bug #23909 [Console] Initialize lazily to render exceptions properly (nicolas-grekas)
35+
* bug #23878 [VarDumper] play nice with open_basedir when looking for composer.json (nicolas-grekas)
36+
* bug #23897 Allow phpdocumentor/reflection-docblock 4 (derrabus)
37+
* bug #23865 [Workflow] fixed InvalidDefinitionException message for StateMachineValidator (fmata)
38+
* bug #23856 [DI] Fix dumping abstract with YamlDumper (nicolas-grekas)
39+
* bug #23848 restrict reflection doc block (ElectricMaxxx)
40+
* bug #23854 [DI] Fix YamlDumper not dumping abstract and autoconfigure (nicolas-grekas)
41+
* bug #23752 Ignore memcached missing key error on session destroy (jderusse)
42+
* bug #23829 Fixed the exception page design in responsive mode (javiereguiluz)
43+
* bug #23828 [Console] Log exit codes as debug messages instead of errors (haroldiedema)
44+
* bug #23763 [Cache] Hash cache key on save (lstrojny)
45+
* bug #23806 [Profiler] Fix request_collector check in main layout (ogizanagi)
46+
* bug #23658 [HttpFoundation] Generate safe fallback filename for wrongly encoded filename (xelaris)
47+
* bug #23776 [FrameworkBundle] Warmup annotations for bundle-less controllers and entities (nicolas-grekas)
48+
* bug #23783 Avoid infinite loops when profiler data is malformed (javiereguiluz)
49+
* bug #23638 [FrameworkBundle][Workflow] better errors when security deps are missing (xabbuh)
50+
* bug #23729 [Bridge\ProxyManager] Dont call __destruct() on non-instantiated services (nicolas-grekas)
51+
* bug #23703 Bump minimal PHP version to ^5.5.9|>=7.0.8 (nicolas-grekas)
52+
* bug #23755 [Config] Fix checking class existence freshness (nicolas-grekas)
53+
1054
* 3.3.6 (2017-08-01)
1155

1256
* bug #22244 [Console] Fix passing options with defaultCommand (Jakub Sacha)

UPGRADE-3.4.md

+6
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ FrameworkBundle
114114
class has been deprecated and will be removed in 4.0. Use the
115115
`Symfony\Component\Translation\DependencyInjection\TranslatorPass` class instead.
116116

117+
* The `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`
118+
class has been deprecated and will be removed in 4.0. Use the
119+
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
120+
121+
* The `translation.loader` service has been deprecated and will be removed in 4.0. Use the `translation.reader` service instead.
122+
117123
HttpKernel
118124
----------
119125

UPGRADE-4.0.md

+8
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,13 @@ FrameworkBundle
417417
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass`
418418
class has been removed. Use the
419419
`Symfony\Component\Translation\DependencyInjection\TranslatorPass` class instead.
420+
421+
* The `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`
422+
class has been deprecated and will be removed in 4.0. Use the
423+
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
420424

425+
* The `translation.loader` service has been deprecated and will be removed in 4.0. Use the `translation.reader` service instead.
426+
421427
HttpFoundation
422428
--------------
423429

@@ -588,6 +594,8 @@ Translation
588594

589595
* Removed the backup feature from the file dumper classes.
590596

597+
* The default value of the `$readerServiceId` argument of `TranslatorPass::__construct()` has been changed to `"translation.reader"`.
598+
591599
* Removed `Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations`,
592600
use `Symfony\Component\Translation\Writer\TranslationWriter::write` instead.
593601

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
"predis/predis": "~1.0",
9595
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
9696
"symfony/phpunit-bridge": "~3.2",
97-
"symfony/polyfill-apcu": "~1.1",
9897
"symfony/security-acl": "~2.8|~3.0",
9998
"phpdocumentor/reflection-docblock": "^3.0|^4.0"
10099
},

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@
1515

1616
error_reporting(-1);
1717

18-
// PHPUnit 4.8 does not support PHP 7, while 5.1 requires PHP 5.6+
19-
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? getenv('SYMFONY_PHPUNIT_VERSION') ?: '5.7' : '4.8';
18+
if (PHP_VERSION_ID >= 70200) {
19+
// PHPUnit 6 is required for PHP 7.2+
20+
$PHPUNIT_VERSION = getenv('SYMFONY_PHPUNIT_VERSION') ?: '6.3';
21+
} elseif (PHP_VERSION_ID >= 50600) {
22+
// PHPUnit 4 does not support PHP 7
23+
$PHPUNIT_VERSION = getenv('SYMFONY_PHPUNIT_VERSION') ?: '5.7';
24+
} else {
25+
// PHPUnit 5.1 requires PHP 5.6+
26+
$PHPUNIT_VERSION = '4.8';
27+
}
28+
2029
$oldPwd = getcwd();
2130
$PHPUNIT_DIR = getenv('SYMFONY_PHPUNIT_DIR') ?: (__DIR__.'/.phpunit');
2231
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ CHANGELOG
4343
name as value, using it makes the command lazy
4444
* Added `cache:pool:prune` command to allow manual stale cache item pruning of supported PSR-6 and PSR-16 cache pool
4545
implementations
46+
* Deprecated `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`, use
47+
`Symfony\Component\Translation\Reader\TranslationReader` instead
48+
* Deprecated `translation.loader` service, use `translation.reader` instead
4649

4750
3.3.0
4851
-----

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14-
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
1514
use Symfony\Component\Console\Command\Command;
1615
use Symfony\Component\Console\Style\SymfonyStyle;
1716
use Symfony\Component\Console\Input\InputInterface;
@@ -22,6 +21,7 @@
2221
use Symfony\Component\Translation\Catalogue\MergeOperation;
2322
use Symfony\Component\Translation\Extractor\ExtractorInterface;
2423
use Symfony\Component\Translation\MessageCatalogue;
24+
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
2525
use Symfony\Component\Translation\Translator;
2626
use Symfony\Component\Translation\DataCollectorTranslator;
2727
use Symfony\Component\Translation\LoggingTranslator;
@@ -44,15 +44,15 @@ class TranslationDebugCommand extends Command
4444
protected static $defaultName = 'debug:translation';
4545

4646
private $translator;
47-
private $loader;
47+
private $reader;
4848
private $extractor;
4949

50-
public function __construct(TranslatorInterface $translator, TranslationLoader $loader, ExtractorInterface $extractor)
50+
public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor)
5151
{
5252
parent::__construct();
5353

5454
$this->translator = $translator;
55-
$this->loader = $loader;
55+
$this->reader = $reader;
5656
$this->extractor = $extractor;
5757
}
5858

@@ -295,7 +295,7 @@ private function loadCurrentMessages($locale, $transPaths)
295295
foreach ($transPaths as $path) {
296296
$path = $path.'translations';
297297
if (is_dir($path)) {
298-
$this->loader->loadMessages($path, $currentCatalogue);
298+
$this->reader->read($path, $currentCatalogue);
299299
}
300300
}
301301

@@ -321,7 +321,7 @@ private function loadFallbackCatalogues($locale, $transPaths)
321321
foreach ($transPaths as $path) {
322322
$path = $path.'translations';
323323
if (is_dir($path)) {
324-
$this->loader->loadMessages($path, $fallbackCatalogue);
324+
$this->reader->read($path, $fallbackCatalogue);
325325
}
326326
}
327327
$fallbackCatalogues[] = $fallbackCatalogue;

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

+5-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14-
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
1514
use Symfony\Component\Console\Command\Command;
1615
use Symfony\Component\Console\Style\SymfonyStyle;
1716
use Symfony\Component\Translation\Catalogue\TargetOperation;
@@ -22,6 +21,7 @@
2221
use Symfony\Component\Console\Input\InputOption;
2322
use Symfony\Component\Translation\Extractor\ExtractorInterface;
2423
use Symfony\Component\Translation\MessageCatalogue;
24+
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
2525
use Symfony\Component\Translation\Writer\TranslationWriterInterface;
2626

2727
/**
@@ -37,22 +37,16 @@ class TranslationUpdateCommand extends Command
3737
protected static $defaultName = 'translation:update';
3838

3939
private $writer;
40-
private $loader;
40+
private $reader;
4141
private $extractor;
4242
private $defaultLocale;
4343

44-
/**
45-
* @param TranslationWriterInterface $writer
46-
* @param TranslationLoader $loader
47-
* @param ExtractorInterface $extractor
48-
* @param string $defaultLocale
49-
*/
50-
public function __construct(TranslationWriterInterface $writer, TranslationLoader $loader, ExtractorInterface $extractor, $defaultLocale)
44+
public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, $defaultLocale)
5145
{
5246
parent::__construct();
5347

5448
$this->writer = $writer;
55-
$this->loader = $loader;
49+
$this->reader = $reader;
5650
$this->extractor = $extractor;
5751
$this->defaultLocale = $defaultLocale;
5852
}
@@ -162,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
162156
foreach ($transPaths as $path) {
163157
$path .= 'translations';
164158
if (is_dir($path)) {
165-
$this->loader->loadMessages($path, $currentCatalogue);
159+
$this->reader->read($path, $currentCatalogue);
166160
}
167161
}
168162

src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@
121121
<tag name="translation.extractor" alias="php" />
122122
</service>
123123

124-
<service id="translation.loader" class="Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader" public="true" />
124+
<service id="translation.loader" class="Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader" public="true">
125+
<deprecated>The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use "translation.reader" instead.</deprecated>
126+
</service>
127+
<service id="translation.reader" class="Symfony\Component\Translation\Reader\TranslationReader" public="true" />
125128

126129
<service id="translation.extractor" class="Symfony\Component\Translation\Extractor\ChainExtractor" public="true" />
127130

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag
130130
})
131131
);
132132

133-
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
133+
$loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock();
134134
$loader
135135
->expects($this->any())
136-
->method('loadMessages')
136+
->method('read')
137137
->will(
138138
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
139139
$catalogue->add($loadedMessages);

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag
101101
})
102102
);
103103

104-
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
104+
$loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock();
105105
$loader
106106
->expects($this->any())
107-
->method('loadMessages')
107+
->method('read')
108108
->will(
109109
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
110110
$catalogue->add($loadedMessages);

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ protected function createContainerFromFile($file, $data = array(), $resetCompile
978978
$container->getCompilerPassConfig()->setOptimizationPasses(array());
979979
$container->getCompilerPassConfig()->setRemovingPasses(array());
980980
}
981-
$container->getCompilerPassConfig()->setBeforeRemovingPasses(array(new AddAnnotationsCachedReaderPass(), new AddConstraintValidatorsPass(), new TranslatorPass()));
981+
$container->getCompilerPassConfig()->setBeforeRemovingPasses(array(new AddAnnotationsCachedReaderPass(), new AddConstraintValidatorsPass(), new TranslatorPass('translator.default', 'translation.reader')));
982982
$container->compile();
983983

984984
return self::$containerCache[$cacheKey] = $container;

src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php

+6-38
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,16 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Translation;
1313

14-
use Symfony\Component\Finder\Finder;
14+
use Symfony\Component\Translation\Reader\TranslationReader;
1515
use Symfony\Component\Translation\MessageCatalogue;
16-
use Symfony\Component\Translation\Loader\LoaderInterface;
16+
17+
@trigger_error(sprintf('The class "%s" is deprecated since version 3.4 and will be removed in 4.0. Use "%s" instead. ', TranslationLoader::class, TranslationReader::class), E_USER_DEPRECATED);
1718

1819
/**
19-
* TranslationLoader loads translation messages from translation files.
20-
*
21-
* @author Michel Salib <[email protected]>
20+
* @deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\Reader\TranslationReader instead
2221
*/
23-
class TranslationLoader
22+
class TranslationLoader extends TranslationReader
2423
{
25-
/**
26-
* Loaders used for import.
27-
*
28-
* @var array
29-
*/
30-
private $loaders = array();
31-
32-
/**
33-
* Adds a loader to the translation extractor.
34-
*
35-
* @param string $format The format of the loader
36-
* @param LoaderInterface $loader
37-
*/
38-
public function addLoader($format, LoaderInterface $loader)
39-
{
40-
$this->loaders[$format] = $loader;
41-
}
42-
4324
/**
4425
* Loads translation messages from a directory to the catalogue.
4526
*
@@ -48,19 +29,6 @@ public function addLoader($format, LoaderInterface $loader)
4829
*/
4930
public function loadMessages($directory, MessageCatalogue $catalogue)
5031
{
51-
if (!is_dir($directory)) {
52-
return;
53-
}
54-
55-
foreach ($this->loaders as $format => $loader) {
56-
// load any existing translation files
57-
$finder = new Finder();
58-
$extension = $catalogue->getLocale().'.'.$format;
59-
$files = $finder->files()->name('*.'.$extension)->in($directory);
60-
foreach ($files as $file) {
61-
$domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1);
62-
$catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
63-
}
64-
}
32+
$this->read($directory, $catalogue);
6533
}
6634
}

src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function __construct($file, AdapterInterface $fallbackPool)
3838
{
3939
$this->file = $file;
4040
$this->fallbackPool = $fallbackPool;
41+
$this->zendDetectUnicode = ini_get('zend.detect_unicode');
4142
$this->createCacheItem = \Closure::bind(
4243
function ($key, $value, $isHit) {
4344
$item = new CacheItem();

src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php

+1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ public function __construct($namespace = '', $defaultLifetime = 0, $directory =
3636

3737
$e = new \Exception();
3838
$this->includeHandler = function () use ($e) { throw $e; };
39+
$this->zendDetectUnicode = ini_get('zend.detect_unicode');
3940
}
4041
}

0 commit comments

Comments
 (0)