8000 Merge branch '6.0' into 6.1 · symfony/symfony@a1133b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a1133b5

Browse files
Merge branch '6.0' into 6. 8000 1
* 6.0: [Cache] fix tests [Cache] conflict with ext-memcached <= 3.1.5 on PHP 8.1 [Ldap] fix deprecation on PHP 8.1
2 parents abd7a2c + ba413e1 commit a1133b5

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class MemcachedAdapter extends AbstractAdapter
5656
public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
5757
{
5858
if (!static::isSupported()) {
59-
throw new CacheException('Memcached >= 2.2.0 is required.');
59+
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
6060
}
6161
if ('Memcached' === \get_class($client)) {
6262
$opt = $client->getOption(\Memcached::OPT_SERIALIZER);
@@ -76,7 +76,7 @@ public function __construct(\Memcached $client, string $namespace = '', int $def
7676

7777
public static function isSupported()
7878
{
79-
return \extension_loaded('memcached') && version_compare(phpversion('memcached'), '2.2.0', '>=');
79+
return \extension_loaded('memcached') && version_compare(phpversion('memcached'), \PHP_VERSION_ID >= 80100 ? '3.1.6' : '2.2.0', '>=');
8080
}
8181

8282
/**
@@ -89,7 +89,6 @@ public static function isSupported()
8989
* - [['localhost', 11211, 33]]
9090
*
9191
* @param array[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs
92-
* @param array $options An array of options
9392
*
9493
* @throws \ErrorException When invalid options or servers are provided
9594
*/
@@ -101,7 +100,7 @@ public static function createConnection(array|string $servers, array $options =
101100
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', get_debug_type($servers)));
102101
}
103102
if (!static::isSupported()) {
104-
throw new CacheException('Memcached >= 2.2.0 is required.');
103+
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
105104
}
106105
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
107106
try {
@@ -265,7 +264,7 @@ protected function doSave(array $values, int $lifetime): array|bool
265264
protected function doFetch(array $ids): iterable
266265
{
267266
try {
268-
$encodedIds = array_map('self::encodeKey', $ids);
267+
$encodedIds = array_map([__CLASS__, 'encodeKey'], $ids);
269268

270269
$encodedResult = $this->checkResultCode($this->getClient()->getMulti($encodedIds));
271270

@@ -294,7 +293,7 @@ protected function doHave(string $id): bool
294293
protected function doDelete(array $ids): bool
295294
{
296295
$ok = true;
297-
$encodedIds = array_map('self::encodeKey', $ids);
296+
$encodedIds = array_map([__CLASS__, 'encodeKey'], $ids);
298297
foreach ($this->checkResultCode($this->getClient()->deleteMulti($encodedIds)) as $result) {
299298
if (\Memcached::RES_SUCCESS !== $result && \Memcached::RES_NOTFOUND !== $result) {
300299
$ok = false;

src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MemcachedAdapterTest extends AdapterTestCase
3333
public static function setUpBeforeClass(): void
3434
{
3535
if (!MemcachedAdapter::isSupported()) {
36-
throw new SkippedTestSuiteError('Extension memcached >=2.2.0 required.');
36+
throw new SkippedTestSuiteError('Extension memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' required.');
3737
}
3838
self::$client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]);
3939
self::$client->get('foo');

src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function rename(Entry $entry, string $newRdn, bool $removeOldRdn = true)
105105
{
106106
$con = $this->getConnectionResource();
107107

108-
if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) {
108+
if (!@ldap_rename($con, $entry->getDn(), $newRdn, '', $removeOldRdn)) {
109109
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": ', $entry->getDn(), $newRdn).ldap_error($con), ldap_errno($con));
110110
}
111111
}

0 commit comments

Comments
 (0)
0