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 7ce2f24

Browse filesBrowse files
Merge branch '5.0'
* 5.0: [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 f8b86df + 4042cc4 commit 7ce2f24
Copy full SHA for 7ce2f24

File tree

Expand file treeCollapse file tree

11 files changed

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

11 files changed

+54
-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
@@ -48,7 +48,8 @@
4848
<service id="Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface" alias="session.flash_bag" />
4949

5050
<service id="session.attribute_bag" class="Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag">
51-
<factory service="session" method="getAttributeBag" />
51+
<factory service="session" method="getBag"/>
52+
<argument>attributes</argument>
5253
<deprecated package="symfony/framework-bundle" version="5.1">The "%service_id%" service is deprecated, use "$session->getAttributeBag()" instead.</deprecated>
5354
</service>
5455

‎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
private $priority;
3835

3936
/**

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Routing\Loader\Configurator;
1313

1414
use Symfony\Component\Routing\RouteCollection;
15+
use Symfony\Component\Routing\RouteCompiler;
1516

1617
/**
1718
* @author Nicolas Grekas <p@tchwork.com>

‎src/Symfony/Component/Routing/Loader/Configurator/Traits/PrefixTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/Configurator/Traits/PrefixTrait.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ final protected function addPrefix(RouteCollection $routes, $prefix, bool $trail
3333
foreach ($prefix as $locale => $localePrefix) {
3434
$localizedRoute = clone $route;
3535
$localizedRoute->setDefault('_locale', $locale);
36+
$localizedRoute->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
3637
$localizedRoute->setDefault('_canonical_route', $name);
3738
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
3839
$routes->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
@@ -237,6 +237,7 @@ public function testRoutingI18nConfigurator()
237237
$expectedCollection->add('baz.en', (new Route('/baz'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'baz'])->setRequirement('_locale', 'en'));
238238
$expectedCollection->add('c_foo.fr', (new Route('/ench/pub/foo'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_foo'])->setRequirement('_locale', 'fr'));
239239
$expectedCollection->add('c_bar.fr', (new Route('/ench/pub/bar'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_bar'])->setRequirement('_locale', 'fr'));
240+
$expectedCollection->add('non_localized.fr', (new Route('/ench/non-localized'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'non_localized'])->setRequirement('_locale', 'fr'));
240241

241242
$expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub_i18n.php')));
242243
$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
@@ -205,6 +205,9 @@ public function testLocalizedImportsOfNotLocalizedRoutes()
205205

206206
$this->assertEquals('/le-prefix/suffix', $routeCollection->get('imported.fr')->getPath());
207207
$this->assertEquals('/the-prefix/suffix', $routeCollection->get('imported.en')->getPath());
208+
209+
$this->assertSame('fr', $routeCollection->get('imported.fr')->getRequirement('_locale'));
210+
$this->assertSame('en', $routeCollection->get('imported.en')->getRequirement('_locale'));
208211
}
209212

210213
/**

‎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
@@ -338,6 +338,9 @@ public function testImportingNonLocalizedRoutesWithLocales()
338338
$this->assertCount(2, $routes);
339339
$this->assertEquals('/nl/imported', $routes->get('imported.nl')->getPath());
340340
$this->assertEquals('/en/imported', $routes->get('imported.en')->getPath());
341+
342+
$this->assertSame('nl', $routes->get('imported.nl')->getRequirement('_locale'));
343+
$this->assertSame('en', $routes->get('imported.en')->getRequirement('_locale'));
341344
}
342345

343346
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.