Skip to content

[DoctrineBridge] Fix bug with date immutable and datetime immutable #39469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
6ad0169
[Intl] deprecate polyfills in favor of symfony/polyfill-intl-icu
nicolas-grekas Nov 3, 2020
b285584
updated version to 5.3
fabpot Nov 10, 2020
7e3855d
feature #38974 [Intl] deprecate polyfills in favor of symfony/polyfil…
nicolas-grekas Nov 11, 2020
f0ff411
Merge branch '5.2' into 5.x
nicolas-grekas Nov 11, 2020
66edc59
[Messenger][SQS] Make sure one can enable debug logs
Nyholm Nov 5, 2020
1d945b9
feature #38998 [Messenger][SQS] Make sure one can enable debug logs (…
chalasr Nov 11, 2020
c2fa2cb
[BrowserKit] Add jsonRequest function to the browser-kit client
alexander-schranz Oct 16, 2020
16fb94b
feature #38596 [BrowserKit] Add jsonRequest function to the browser-k…
chalasr Nov 11, 2020
9e5fefa
Merge branch '5.2' into 5.x
jderusse Nov 12, 2020
430b916
Merge branch '5.2' into 5.x
derrabus Nov 12, 2020
c82c997
Merge branch '5.2' into 5.x
xabbuh Nov 13, 2020
281af26
[Messenger] Make all the dependencies of AmazonSqsTransport injectable
jacekwilczynski Oct 26, 2020
b77ef9f
feature #38846 [Messenger] Make all the dependencies of AmazonSqsTran…
derrabus Nov 15, 2020
2a453c2
Merge branch '5.2' into 5.x
derrabus Nov 15, 2020
46a8007
[Messenger] Allow InMemoryTransport to serialize message
tyx Nov 13, 2020
2fa9291
Merge branch '5.2' into 5.x
derrabus Nov 16, 2020
d3b9440
[Ldap] Ldap Entry case-sensitive attribute key option
karlshea Nov 8, 2020
3c0cfbc
Merge branch '5.2' into 5.x
derrabus Nov 18, 2020
f0bbdc8
[Console][Yaml] Linter: add Github annotations format for errors
ogizanagi Nov 3, 2020
04eec8b
feature #38982 [Console][Yaml] Linter: add Github annotations format …
chalasr Nov 20, 2020
a273b71
feature #39075 [Messenger]  Allow InMemoryTransport to serialize mess…
chalasr Nov 20, 2020
49eafee
Merge branch '5.2' into 5.x
xabbuh Nov 21, 2020
449147b
Added Invalid constant into Command Class
TheGarious Nov 23, 2020
a07b722
Merge branch '5.2' into 5.x
derrabus Nov 27, 2020
4346ef4
feature #39146 [Console] Added Invalid constant into Command Class (T…
fabpot Nov 27, 2020
a4b2bf8
feature #39037 [Ldap] Ldap Entry case-sensitive attribute key option …
fabpot Nov 27, 2020
3ac26fc
Remove extra docblock
fabpot Nov 27, 2020
4c74dea
Cache discovered namespaces in DomCrawler
simonberger Nov 16, 2020
a8e85ec
Make some CS changes
fabpot Nov 27, 2020
bd7a3e1
feature #39097 [DomCrawler] Cache discovered namespaces (simonberger,…
fabpot Nov 27, 2020
a2691d3
Merge branch '5.2' into 5.x
fabpot Nov 27, 2020
f0aa4e7
Merge branch '5.2' into 5.x
fabpot Nov 27, 2020
4981330
Merge branch '5.2' into 5.x
derrabus Nov 28, 2020
cf31b29
Merge branch '5.2' into 5.x
nicolas-grekas Nov 28, 2020
c31fc9d
Merge branch '5.2' into 5.x
nicolas-grekas Nov 28, 2020
55a67ff
Merge branch '5.2' into 5.x
derrabus Nov 28, 2020
f0dfb9e
Merge branch '5.2' into 5.x
derrabus Nov 29, 2020
4f59d2f
Merge branch '5.2' into 5.x
derrabus Nov 30, 2020
ff97b5f
Merge branch '5.2' into 5.x
derrabus Nov 30, 2020
6687e23
Add ContextBlock for slack notifier
norkunas Dec 1, 2020
e97f9e7
Merge branch '5.2' into 5.x
derrabus Dec 2, 2020
31ee43a
Merge branch '5.2' into 5.x
derrabus Dec 3, 2020
a7936d2
[Notifier] Check for maximum number of buttons in slack action block
malteschlueter Dec 3, 2020
53e1bc0
feature #39300 [Notifier] Check for maximum number of buttons in slac…
fabpot Dec 5, 2020
bb0362d
feature #39258 [Notifier] Add ContextBlock for slack notifier (norkunas)
fabpot Dec 5, 2020
4dd16d1
Fix CS
fabpot Dec 5, 2020
db4883d
Merge branch '5.2' into 5.x
fabpot Dec 5, 2020
b07608c
Move @experimental annotations to 5.3
fabpot Dec 5, 2020
21d4c09
minor #39320 Move @experimental annotations to 5.3 (fabpot)
fabpot Dec 5, 2020
1bf4341
Merge branch '5.2' into 5.x
derrabus Dec 5, 2020
de0dbd8
[DependencyInjection] Add missing parameter type declarations to load…
derrabus Dec 2, 2020
ce77be2
[Form] Changed DataMapperInterface $forms parameter type to \Traversable
vudaltsov Dec 5, 2020
37d823d
feature #39317 [Form] Changed DataMapperInterface $forms parameter ty…
derrabus Dec 5, 2020
ab31ee9
Search for pattern on debug:event-dispatcher
Nyholm Dec 5, 2020
caeac51
feature #39323 Search for pattern on debug:event-dispatcher (Nyholm)
fabpot Dec 5, 2020
751352c
minor #39292 [DependencyInjection] Add missing parameter type declara…
fabpot Dec 5, 2020
7dcaf98
Merge branch '5.2' into 5.x
fabpot Dec 5, 2020
a4b2606
Extracting ProgressBar's format's magic strings into const
CesarScur Nov 9, 2020
45519f2
[FrameworkBundle] Added support for configuring PHP error level to lo…
lyrixx Nov 6, 2020
df65ffe
feature #39042 [Console] Extracting ProgressBar's format's magic stri…
fabpot Dec 5, 2020
e6eef9b
bug #39018 [FrameworkBundle] Fixed validation of php_errors.log (lyrixx)
fabpot Dec 5, 2020
ffab85c
Merge branch '5.2' into 5.x
derrabus Dec 5, 2020
62398b5
[FrameworkBundle] Added option to specify the event dispatcher in deb…
TimoBakx Dec 1, 2020
86842ac
feature #39276 [FrameworkBundle] Added option to specify the event di…
derrabus Dec 5, 2020
8143f8a
Fix CS.
derrabus Dec 5, 2020
d907d3b
Fix broken link to documentation in Lock and Semaphore components
ronnylt Dec 6, 2020
9d40bd8
minor #39348 Fix broken link to documentation in Lock and Semaphore c…
Nyholm Dec 6, 2020
ffdfb4f
Assert voter returns valid decision
jderusse Dec 5, 2020
e9ab48f
Merge branch '5.2' into 5.x
derrabus Dec 7, 2020
41c5901
[FrameworkBundle] Add validator.expression_language service
fbourigault Dec 5, 2020
e9108e9
feature #39327 [FrameworkBundle] Add validator.expression_language se…
fabpot Dec 8, 2020
8fa2954
feature #39340 [Security] Assert voter returns valid decision (jderusse)
fabpot Dec 8, 2020
4da4f50
Merge branch '5.2' into 5.x
fabpot Dec 8, 2020
814ffab
[Cache] Support Redis Sentinel mode when using phpredis/phpredis exte…
renan Dec 7, 2020
979a539
feature #39363 [Cache] Support Redis Sentinel mode when using phpredi…
nicolas-grekas Dec 8, 2020
a885ba8
[Messenger] Use "warning" intead of "error" log level for Recoverable…
lyrixx Dec 8, 2020
620ee34
[Cache] hotfix
nicolas-grekas Dec 8, 2020
1ee7e4c
[HttpKernel] Marked the class `Symfony\Component\HttpKernel\EventList…
lyrixx Nov 30, 2020
d07b951
minor #39016 [HttpKernel] Marked the class DebugHandlersListener as i…
nicolas-grekas Dec 8, 2020
93c2f5e
[BrowserKit] Allowing body content from GET with a content-type
thiagomp Oct 18, 2020
219d511
feature #38622 [BrowserKit] Allowing body content from GET with a con…
nicolas-grekas Dec 8, 2020
7f9237e
[ErrorHandler] fix html W3C compliance
awoimbee Oct 8, 2020
0dce5cf
minor #38490 [ErrorHandler] fix html W3C compliance (awoimbee)
nicolas-grekas Dec 8, 2020
be5f6e5
Merge branch '5.2' into 5.x
nicolas-grekas Dec 8, 2020
e6f1136
Merge branch '5.2' into 5.x
nicolas-grekas Dec 8, 2020
fda67f5
Merge branch '5.2' into 5.x
nicolas-grekas Dec 8, 2020
266a6bb
Merge branch '5.2' into 5.x
nicolas-grekas Dec 9, 2020
8b8bffb
feature #39378 [Messenger] Use "warning" instead of "error" log level…
fabpot Dec 10, 2020
122eaba
[TwigBridge] export concatenated translations
Dec 6, 2020
b82bc85
feature #39352 [TwigBridge] export concatenated translations (Stephen)
fabpot Dec 10, 2020
1ce5b03
[Form] Add "choice_translation_parameters" option
VincentLanglet May 18, 2020
9b64be8
feature #38469 [Form] Add "choice_translation_parameters" option (Vin…
fabpot Dec 10, 2020
19b20ab
Merge branch '5.2' into 5.x
derrabus Dec 10, 2020
14e36a2
[Cache] Make use of `read_timeout` in `\RedisSentinel` and `\Redis`
ferrastas Dec 10, 2020
7c98ee1
bug #39431 [Cache] Make use of `read_timeout` in `\RedisSentinel` and…
nicolas-grekas Dec 10, 2020
276bbb5
[Cache] Bugfix provide the correct host and port when throwing the ex…
renan Dec 10, 2020
f66b853
bug #39434 [Cache] Bugfix provide the correct host and port when thro…
nicolas-grekas Dec 10, 2020
e4febad
Merge branch '5.2' into 5.x
nicolas-grekas Dec 10, 2020
d985ca9
[Messenger] Added more descriptive exception message when handling of…
loevgaard Dec 10, 2020
fccb4c9
minor #39423 [Messenger] Added more descriptive exception message whe…
nicolas-grekas Dec 10, 2020
61d9514
Merge branch '5.2' into 5.x
jderusse Dec 10, 2020
fb22eec
Fix CS in changelogs
jderusse Dec 10, 2020
67d2a20
minor #39441 Fix CS in changelogs (jderusse)
derrabus Dec 10, 2020
c6de408
Merge branch '5.2' into 5.x
nicolas-grekas Dec 10, 2020
b47b239
Merge branch '5.2' into 5.x
nicolas-grekas Dec 11, 2020
3c5e168
Fix #39468 with date immutable
FlorianM11 Dec 11, 2020
798a628
Added more tests
guillaume-sainthillier Dec 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Symfony/Component/Ldap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

5.3.0
-----

* Added caseSensitive option for attribute keys in the Entry class.

5.1.0
-----

Expand Down
54 changes: 47 additions & 7 deletions src/Symfony/Component/Ldap/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@

/**
* @author Charles Sarrazin <charles@sarraz.in>
* @author Karl Shea <karl@karlshea.com>
*/
class Entry
{
private $dn;
private $attributes;
private $lowerMap;

public function __construct(string $dn, array $attributes = [])
{
$this->dn = $dn;
$this->attributes = $attributes;
$this->attributes = [];
$this->lowerMap = [];

foreach ($attributes as $key => $attribute) {
$this->setAttribute($key, $attribute);
}
}

/**
Expand All @@ -38,13 +45,21 @@ public function getDn()
/**
* Returns whether an attribute exists.
*
* @param string $name The name of the attribute
* @param string $name The name of the attribute
* @param bool $caseSensitive Whether the check should be case-sensitive
*
* @return bool
*/
public function hasAttribute(string $name)
public function hasAttribute(string $name/* , bool $caseSensitive = true */)
{
return isset($this->attributes[$name]);
$caseSensitive = 2 > \func_num_args() || true === func_get_arg(1);
$attributeKey = $this->getAttributeKey($name, $caseSensitive);

if (null === $attributeKey) {
return false;
}

return isset($this->attributes[$attributeKey]);
}

/**
Expand All @@ -53,13 +68,21 @@ public function hasAttribute(string $name)
* As LDAP can return multiple values for a single attribute,
* this value is returned as an array.
*
* @param string $name The name of the attribute
* @param string $name The name of the attribute
* @param bool $caseSensitive Whether the attribute name is case-sensitive
*
* @return array|null
*/
public function getAttribute(string $name)
public function getAttribute(string $name/* , bool $caseSensitive = true */)
{
return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
$caseSensitive = 2 > \func_num_args() || true === func_get_arg(1);
$attributeKey = $this->getAttributeKey($name, $caseSensitive);

if (null === $attributeKey) {
return null;
}

return $this->attributes[$attributeKey] ?? null;
}

/**
Expand All @@ -78,6 +101,7 @@ public function getAttributes()
public function setAttribute(string $name, array $value)
{
$this->attributes[$name] = $value;
$this->lowerMap[strtolower($name)] = $name;
}

/**
Expand All @@ -86,5 +110,21 @@ public function setAttribute(string $name, array $value)
public function removeAttribute(string $name)
{
unset($this->attributes[$name]);
unset($this->lowerMap[strtolower($name)]);
}

/**
* Get the attribute key.
*
* @param string $name The attribute name
* @param bool $caseSensitive Whether the attribute name is case-sensitive
*/
private function getAttributeKey(string $name, bool $caseSensitive = true): ?string
{
if ($caseSensitive) {
return $name;
}

return $this->lowerMap[strtolower($name)] ?? null;
}
}
42 changes: 42 additions & 0 deletions src/Symfony/Component/Ldap/Tests/EntryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Ldap\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Ldap\Entry;

class EntryTest extends TestCase
{
public function testCaseSensitiveAttributeAccessors()
{
$mail = 'fabpot@symfony.com';
$givenName = 'Fabien Potencier';

$entry = new Entry('cn=fabpot,dc=symfony,dc=com', [
'mail' => [$mail],
'givenName' => [$givenName],
]);

$this->assertFalse($entry->hasAttribute('givenname'));
$this->assertTrue($entry->hasAttribute('givenname', false));

$this->assertNull($entry->getAttribute('givenname'));
$this->assertSame($givenName, $entry->getAttribute('givenname', false)[0]);

$firstName = 'Fabien';

$entry->setAttribute('firstName', [$firstName]);
$this->assertSame($firstName, $entry->getAttribute('firstname', false)[0]);
$entry->removeAttribute('firstName');
$this->assertFalse($entry->hasAttribute('firstname', false));
}
}