Skip to content

Commit 8bcc70a

Browse files
[Cache] Fix compat with ext-redis v6
1 parent 6f6f35a commit 8bcc70a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ install:
1818
- cd ext
1919
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.22-8.2-ts-vs16-x86.zip
2020
- 7z x php_apcu-5.1.22-8.2-ts-vs16-x86.zip -y >nul
21-
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-5.3.7-8.2-ts-vs16-x86.zip
22-
- 7z x php_redis-5.3.7-8.2-ts-vs16-x86.zip -y >nul
21+
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip
22+
- 7z x php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip -y >nul
2323
- cd ..
2424
- copy /Y php.ini-development php.ini-min
2525
- echo memory_limit=-1 >> php.ini-min

src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class RedisProxiesTest extends TestCase
2020
{
2121
/**
22-
* @requires extension redis
22+
* @requires extension redis < 6
2323
*
2424
* @testWith ["Redis"]
2525
* ["RedisCluster"]
@@ -85,19 +85,24 @@ public function testRelayProxy()
8585
*/
8686
public function testRedis6Proxy($class, $stub)
8787
{
88-
$this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable');
89-
90-
$stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php");
91-
$stub = preg_replace('/^class /m', 'return; \0', $stub);
92-
$stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1);
93-
$stub = preg_replace('/^ public const .*/m', '', $stub);
94-
eval(substr($stub, 5));
88+
if (version_compare(phpversion('redis'), '6.0.0', '<')) {
89+
$this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable');
90+
91+
$stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php");
92+
$stub = preg_replace('/^class /m', 'return; \0', $stub);
93+
$stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1);
94+
$stub = preg_replace('/^ public const .*/m', '', $stub);
95+
eval(substr($stub, 5));
96+
$r = new \ReflectionClass($class.'StubInterface');
97+
} else {
98+
$r = new \ReflectionClass($class);
99+
}
95100

96101
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}6Proxy.php");
97102
$proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
98103
$methods = [];
99104

100-
foreach ((new \ReflectionClass($class.'StubInterface'))->getMethods() as $method) {
105+
foreach ($r->getMethods() as $method) {
101106
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) {
102107
continue;
103108
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy