Skip to content

Commit 80c0d97

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: Fixed correct class name in thrown exception Add gc_mem_caches() call for PHP7 after itoken_get_all() as new memory manager will not release small buckets to OS automatically Removed a duplicated test in CardSchemeValidatorTest Fix perf and mem issue when using token_get_all [SecurityBundle] fix SecureRandom service constructor args Normalize params only when used.
2 parents edf351e + e2eb098 commit 80c0d97

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Resources/config/security.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
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" />
17-
</service>
12+
<!-- Pseudorandom Number Generator -->
13+
<service id="security.secure_random" class="Symfony\Component\Security\Core\Util\SecureRandom" />
1814
</services>
1915
</container>

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

0 commit comments

Comments
 (0)