Skip to content

Commit 4fd7d8c

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: replace wurstmeister Docker images for Kafka and Zookeeper [PasswordHasher] Make bcrypt nul byte hash test tolerant to PHP related failures [HttpClient] Revert fixing curl default options [VarExporter] fix proxy helper when a method returns null [Validator] Update Dutch (nl) translation Fix exception thrown during `LDAP_MODIFY_BATCH_REMOVE_ALL` batch operations Fix various warnings across components test suite
2 parents 1567d41 + 4747b50 commit 4fd7d8c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Adapter/ExtLdap/UpdateOperation.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ public function __construct(int $operationType, string $attribute, ?array $value
4848

4949
public function toArray(): array
5050
{
51-
return [
51+
$op = [
5252
'attrib' => $this->attribute,
5353
'modtype' => $this->operationType,
54-
'values' => $this->values,
5554
];
55+
56+
if (\LDAP_MODIFY_BATCH_REMOVE_ALL !== $this->operationType) {
57+
$op['values'] = $this->values;
58+
}
59+
60+
return $op;
5661
}
5762
}

Tests/Adapter/ExtLdap/LdapManagerTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,23 @@ public function testLdapAddAttributeValuesError()
265265
$entryManager->addAttributeValues($entry, 'mail', $entry->getAttribute('mail'));
266266
}
267267

268+
public function testLdapApplyOperationsRemoveAll()
269+
{
270+
$entryManager = $this->adapter->getEntryManager();
271+
272+
$result = $this->executeSearchQuery(1);
273+
$entry = $result[0];
274+
275+
$entryManager->applyOperations($entry->getDn(), [new UpdateOperation(\LDAP_MODIFY_BATCH_REMOVE_ALL, 'mail', null)]);
276+
277+
$result = $this->executeSearchQuery(1);
278+
$entry = $result[0];
279+
280+
$this->assertNull($entry->getAttribute('mail'));
281+
282+
$entryManager->addAttributeValues($entry, 'mail', ['fabpot@symfony.com', 'fabien@potencier.com']);
283+
}
284+
268285
public function testLdapApplyOperationsRemoveAllWithArrayError()
269286
{
270287
$entryManager = $this->adapter->getEntryManager();

0 commit comments

Comments
 (0)