From 8bcc70aa596e68232d955484e0b1631c17fa62ec Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 27 Jul 2023 16:57:45 +0200 Subject: [PATCH] [Cache] Fix compat with ext-redis v6 --- .appveyor.yml | 4 ++-- .../Cache/Tests/Traits/RedisProxiesTest.php | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index bf3f70c786b5a..17723f34aa873 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,8 +18,8 @@ install: - cd ext - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.22-8.2-ts-vs16-x86.zip - 7z x php_apcu-5.1.22-8.2-ts-vs16-x86.zip -y >nul - - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-5.3.7-8.2-ts-vs16-x86.zip - - 7z x php_redis-5.3.7-8.2-ts-vs16-x86.zip -y >nul + - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip + - 7z x php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip -y >nul - cd .. - copy /Y php.ini-development php.ini-min - echo memory_limit=-1 >> php.ini-min diff --git a/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php b/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php index c42631e814e40..b801407e201cc 100644 --- a/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php +++ b/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php @@ -19,7 +19,7 @@ class RedisProxiesTest extends TestCase { /** - * @requires extension redis + * @requires extension redis < 6 * * @testWith ["Redis"] * ["RedisCluster"] @@ -85,19 +85,24 @@ public function testRelayProxy() */ public function testRedis6Proxy($class, $stub) { - $this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable'); - - $stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php"); - $stub = preg_replace('/^class /m', 'return; \0', $stub); - $stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1); - $stub = preg_replace('/^ public const .*/m', '', $stub); - eval(substr($stub, 5)); + if (version_compare(phpversion('redis'), '6.0.0', '<')) { + $this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable'); + + $stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php"); + $stub = preg_replace('/^class /m', 'return; \0', $stub); + $stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1); + $stub = preg_replace('/^ public const .*/m', '', $stub); + eval(substr($stub, 5)); + $r = new \ReflectionClass($class.'StubInterface'); + } else { + $r = new \ReflectionClass($class); + } $proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}6Proxy.php"); $proxy = substr($proxy, 0, 4 + strpos($proxy, '[];')); $methods = []; - foreach ((new \ReflectionClass($class.'StubInterface'))->getMethods() as $method) { + foreach ($r->getMethods() as $method) { if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) { continue; } 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