Skip to content

Commit ac08db9

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: (28 commits) [Process] Use stream based storage to avoid memory issues Fix upgrade guides concerning erroneous removal of assets helper [Process] Remove a misleading comment Fix markdown typo ChooseBaseUrl should return an index [Form] ChoiceType: Fix a notice when 'choices' normalizer is replaced Improve the phpdoc of SplFileInfo methods [Process] Use stream based storage to avoid memory issues [FrameworkBundle] Don't log twice with the error handler Remove useless is_object condition [Process] Fix typo, no arguments needed anymore [Serializer] Introduce constants for context keys Fixed the documentation of VoterInterface::supportsAttribute Fixed Bootstrap form theme form "reset" buttons Remove useless duplicated tests [FrameworkBundle] Optimize framework extension tests synchronize 2.7 and 3.0 upgrade files fix merge 2.3 into 2.7 for SecureRandom dependency Use is_subclass_of instead of reflection Use is_subclass_of instead of Reflection when possible ...
2 parents c4d7e47 + 21b4619 commit ac08db9

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

DependencyInjection/Compiler/AddConsoleCommandPass.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public function process(ContainerBuilder $container)
3737
}
3838

3939
$class = $container->getParameterBag()->resolveValue($definition->getClass());
40-
$r = new \ReflectionClass($class);
41-
if (!$r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command')) {
40+
if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) {
4241
throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id));
4342
}
4443
$container->setAlias('console.command.'.strtolower(str_replace('\\', '_', $class)), $id);

Resources/config/security.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
</parameters>
1010

1111
<services>
12-
<!-- Pseudo-Random Number Generator -->
13-
<service id="security.secure_random" class="%security.secure_random.class%">
14-
<tag name="monolog.logger" channel="security" />
15-
<argument>%kernel.cache_dir%/secure_random.seed</argument>
16-
<argument type="service" id="logger" on-invalid="ignore" />
12+
<!-- Pseudorandom Number Generator -->
13+
<service id="security.secure_random" class="Symfony\Component\Security\Core\Util\SecureRandom">
1714
<deprecated>The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0. Use the random_bytes() function instead.</deprecated>
1815
</service>
1916
</services>

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
abstract class FrameworkExtensionTest extends TestCase
2424
{
25+
private static $containerCache = array();
26+
2527
abstract protected function loadFromFile(ContainerBuilder $container, $file);
2628

2729
public function testCsrfProtection()
@@ -511,6 +513,10 @@ protected function createContainer(array $data = array())
511513

512514
protected function createContainerFromFile($file, $data = array())
513515
{
516+
$cacheKey = md5($file.serialize($data));
517+
if (isset(self::$containerCache[$cacheKey])) {
518+
return self::$containerCache[$cacheKey];
519+
}
514520
$container = $this->createContainer($data);
515521
$container->registerExtension(new FrameworkExtension());
516522
$this->loadFromFile($container, $file);
@@ -519,7 +525,7 @@ protected function createContainerFromFile($file, $data = array())
519525
$container->getCompilerPassConfig()->setRemovingPasses(array());
520526
$container->compile();
521527

522-
return $container;
528+
return self::$containerCache[$cacheKey] = $container;
523529
}
524530

525531
protected function createContainerFromClosure($closure, $data = array())

Translation/PhpExtractor.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public function extract($resource, MessageCatalogue $catalog)
6060
$files = $this->extractFiles($resource);
6161
foreach ($files as $file) {
6262
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
63+
64+
if (PHP_VERSION_ID >= 70000) {
65+
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
66+
gc_mem_caches();
67+
}
6368
}
6469
}
6570

@@ -80,7 +85,7 @@ public function setPrefix($prefix)
8085
*/
8186
protected function normalizeToken($token)
8287
{
83-
if (is_array($token)) {
88+
if (isset($token[1]) && 'b"' !== $token) {
8489
return $token[1];
8590
}
8691

@@ -94,7 +99,7 @@ private function seekToNextRelevantToken(\Iterator $tokenIterator)
9499
{
95100
for (; $tokenIterator->valid(); $tokenIterator->next()) {
96101
$t = $tokenIterator->current();
97-
if (!is_array($t) || ($t[0] !== T_WHITESPACE)) {
102+
if (T_WHITESPACE !== $t[0]) {
98103
break;
99104
}
100105
}
@@ -111,7 +116,7 @@ private function getMessage(\Iterator $tokenIterator)
111116

112117
for (; $tokenIterator->valid(); $tokenIterator->next()) {
113118
$t = $tokenIterator->current();
114-
if (!is_array($t)) {
119+
if (!isset($t[1])) {
115120
break;
116121
}
117122

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"symfony/polyfill-mbstring": "~1.0",
2929
"symfony/filesystem": "~2.3|~3.0.0",
3030
"symfony/routing": "~2.8|~3.0.0",
31-
"symfony/security-core": "~2.6|~3.0.0",
31+
"symfony/security-core": "~2.6.13|~2.7.9|~2.8|~3.0.0",
3232
"symfony/security-csrf": "~2.6|~3.0.0",
3333
"symfony/stopwatch": "~2.3|~3.0.0",
3434
"symfony/templating": "~2.1|~3.0.0",

0 commit comments

Comments
 (0)