From 49fd0efb12434655c60f317d6757b65dfddbbe88 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 23 May 2020 11:54:14 +0200 Subject: [PATCH] [Cache] Accessing undefined constants raises an Error in php8 --- .../Cache/Tests/Adapter/MemcachedAdapterTest.php | 10 ++++++++-- .../Cache/Tests/Simple/MemcachedCacheTest.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php index 3a996079ad..8fe807f880 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php @@ -66,8 +66,14 @@ class MemcachedAdapterTest extends AdapterTestCase */ public function testBadOptions($name, $value) { - $this->expectException('ErrorException'); - $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); + if (\PHP_VERSION_ID < 80000) { + $this->expectException('ErrorException'); + $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); + } else { + $this->expectException('Error'); + $this->expectExceptionMessage('Undefined class constant \'Memcached::'); + } + MemcachedAdapter::createConnection([], [$name => $value]); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php index 21332232bc..92fc7d2a87 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php @@ -76,8 +76,14 @@ class MemcachedCacheTest extends CacheTestCase */ public function testBadOptions($name, $value) { - $this->expectException('ErrorException'); - $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); + if (\PHP_VERSION_ID < 80000) { + $this->expectException('ErrorException'); + $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); + } else { + $this->expectException('Error'); + $this->expectExceptionMessage('Undefined class constant \'Memcached::'); + } + MemcachedCache::createConnection([], [$name => $value]); }