Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4042cc4

Browse filesBrowse files
Merge branch '4.4' into 5.0
* 4.4: [FrameworkBundle] Fix session.attribute_bag service definition [Routing] Remove unused properties from the Route annotation [Routing] Add missing _locale requirements Update LdapBindAuthenticationProvider.php Add reproducer to for hit after update expire cacheItem [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
2 parents efbe752 + 0ed6cfd commit 4042cc4
Copy full SHA for 4042cc4

File tree

Expand file treeCollapse file tree

12 files changed

+56
-7
lines changed
Filter options
Expand file treeCollapse file tree

12 files changed

+56
-7
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
<service id="Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface" alias="session.flash_bag" />
4242

4343
<service id="session.attribute_bag" class="Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag">
44-
<factory service="session" method="getAttributeBag"/>
44+
<factory service="session" method="getBag"/>
45+
<argument>attributes</argument>
4546
</service>
4647

4748
<service id="session.storage.mock_file" class="Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage">

‎src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected function doSave(array $values, int $lifetime, array $addTagData = [],
107107

108108
$file = $this->getFile($id);
109109

110-
if (!@symlink($file, $this->getFile($id, true, $tagFolder))) {
110+
if (!@symlink($file, $tagLink = $this->getFile($id, true, $tagFolder)) && !is_link($tagLink)) {
111111
@unlink($file);
112112
$failed[] = $id;
113113
}

‎src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,42 @@ public function testGetMetadata()
141141
$i = $pool->getItem('k');
142142
$this->assertSame(['foo' => 'foo'], $i->getMetadata()[CacheItem::METADATA_TAGS]);
143143
}
144+
145+
public function testRefreshAfterExpires()
146+
{
147+
$pool = $this->createCachePool();
148+
$pool->clear();
149+
150+
$cacheItem = $pool->getItem('test');
151+
152+
$this->assertFalse($cacheItem->isHit());
153+
154+
// write cache with expires
155+
$cacheItem->set('test');
156+
$cacheItem->tag('1234');
157+
$cacheItem->expiresAfter(1);
158+
159+
$pool->save($cacheItem);
160+
161+
$cacheItem = $pool->getItem('test');
162+
$this->assertTrue($cacheItem->isHit());
163+
164+
// wait until expired
165+
sleep(2);
166+
167+
// item should not longer be a hit
168+
$cacheItem = $pool->getItem('test');
169+
$this->assertFalse($cacheItem->isHit());
170+
171+
// update expired item
172+
$cacheItem->set('test');
173+
$cacheItem->tag('1234');
174+
$cacheItem->expiresAfter(1);
175+
176+
$pool->save($cacheItem);
177+
178+
// item should be again a hit
179+
$cacheItem = $pool->getItem('test');
180+
$this->assertTrue($cacheItem->isHit());
181+
}
144182
}

‎src/Symfony/Component/Routing/Annotation/Route.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Annotation/Route.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class Route
3131
private $methods = [];
3232
private $schemes = [];
3333
private $condition;
34-
private $locale;
35-
private $format;
36-
private $utf8;
3734

3835
/**
3936
* @param array $data An array of key/value parameters

‎src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Routing\Route;
1515
use Symfony\Component\Routing\RouteCollection;
16+
use Symfony\Component\Routing\RouteCompiler;
1617

1718
/**
1819
* @author Nicolas Grekas <p@tchwork.com>
@@ -63,6 +64,7 @@ final public function prefix($prefix, bool $trailingSlashOnRoot = true): self
6364
foreach ($prefix as $locale => $localePrefix) {
6465
$localizedRoute = clone $route;
6566
$localizedRoute->setDefault('_locale', $locale);
67+
$localizedRoute->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
6668
$localizedRoute->setDefault('_canonical_route', $name);
6769
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
6870
$this->route->add($name.'.'.$locale, $localizedRoute);

‎src/Symfony/Component/Routing/Loader/XmlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/XmlFileLoader.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, s
211211
$localizedRoute = clone $route;
212212
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
213213
$localizedRoute->setDefault('_locale', $locale);
214+
$localizedRoute->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
214215
$localizedRoute->setDefault('_canonical_route', $name);
215216
$subCollection->add($name.'.'.$locale, $localizedRoute);
216217
}

‎src/Symfony/Component/Routing/Loader/YamlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/YamlFileLoader.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ protected function parseImport(RouteCollection $collection, array $config, strin
216216
foreach ($prefix as $locale => $localePrefix) {
217217
$localizedRoute = clone $route;
218218
$localizedRoute->setDefault('_locale', $locale);
219+
$localizedRoute->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
219220
$localizedRoute->setDefault('_canonical_route', $name);
220221
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
221222
$subCollection->add($name.'.'.$locale, $localizedRoute);

‎src/Symfony/Component/Routing/Tests/Fixtures/php_dsl_sub_i18n.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Fixtures/php_dsl_sub_i18n.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88

99
$add('foo', ['fr' => '/foo']);
1010
$add('bar', ['fr' => '/bar']);
11+
12+
$routes->add('non_localized', '/non-localized');
1113
};

‎src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ public function testRoutingI18nConfigurator()
234234
$expectedCollection->add('baz.en', (new Route('/baz'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'baz'])->setRequirement('_locale', 'en'));
235235
$expectedCollection->add('c_foo.fr', (new Route('/ench/pub/foo'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_foo'])->setRequirement('_locale', 'fr'));
236236
$expectedCollection->add('c_bar.fr', (new Route('/ench/pub/bar'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_bar'])->setRequirement('_locale', 'fr'));
237+
$expectedCollection->add('non_localized.fr', (new Route('/ench/non-localized'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'non_localized'])->setRequirement('_locale', 'fr'));
237238

238239
$expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub_i18n.php')));
239240
$expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_i18n.php')));

‎src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ public function testLocalizedImportsOfNotLocalizedRoutes()
201201

202202
$this->assertEquals('/le-prefix/suffix', $routeCollection->get('imported.fr')->getPath());
203203
$this->assertEquals('/the-prefix/suffix', $routeCollection->get('imported.en')->getPath());
204+
205+
$this->assertSame('fr', $routeCollection->get('imported.fr')->getRequirement('_locale'));
206+
$this->assertSame('en', $routeCollection->get('imported.en')->getRequirement('_locale'));
204207
}
205208

206209
/**

‎src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ public function testImportingNonLocalizedRoutesWithLocales()
334334
$this->assertCount(2, $routes);
335335
$this->assertEquals('/nl/imported', $routes->get('imported.nl')->getPath());
336336
$this->assertEquals('/en/imported', $routes->get('imported.en')->getPath());
337+
338+
$this->assertSame('nl', $routes->get('imported.nl')->getRequirement('_locale'));
339+
$this->assertSame('en', $routes->get('imported.en')->getRequirement('_locale'));
337340
}
338341

339342
public function testImportingRoutesWithOfficialLocales()

‎src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
8282
}
8383

8484
try {
85-
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
86-
8785
if ($this->queryString) {
8886
if ('' !== $this->searchDn && '' !== $this->searchPassword) {
8987
$this->ldap->bind($this->searchDn, $this->searchPassword);
9088
} else {
9189
throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.');
9290
}
91+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_FILTER);
9392
$query = str_replace('{username}', $username, $this->queryString);
9493
$result = $this->ldap->query($this->dnString, $query)->execute();
9594
if (1 !== $result->count()) {
@@ -98,6 +97,7 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
9897

9998
$dn = $result[0]->getDn();
10099
} else {
100+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
101101
$dn = str_replace('{username}', $username, $this->dnString);
102102
}
103103

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.