10000 bug #36917 [Cache] Accessing undefined constants raises an Error in p… · symfony/symfony@6e368f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e368f1

Browse files
bug #36917 [Cache] Accessing undefined constants raises an Error in php8 (derrabus)
This PR was merged into the 3.4 branch. Discussion ---------- [Cache] Accessing undefined constants raises an Error in php8 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #36872 | License | MIT | Doc PR | N/A Calling `constant()` for an undefined constant will raise an `Error` on php 8. This PR adjust the Memcached tests to this new behavior. Commits ------- 49fd0ef [Cache] Accessing undefined constants raises an Error in php8
2 parents ee9aa2d + 49fd0ef commit 6e368f1

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ public function testOptions()
6666
*/
6767
public function testBadOptions($name, $value)
6868
{
69-
$this->expectException('ErrorException');
70-
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
69+
if (\PHP_VERSION_ID < 80000) {
70+
$this->expectException('ErrorException');
71+
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
72+
} else {
73+
$this->expectException('Error');
74+
$this->expectExceptionMessage('Undefined class constant \'Memcached::');
75+
}
76+
7177
MemcachedAdapter::createConnection([], [$name => $value]);
7278
}
7379

src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ public function testOptions()
7676
*/
7777
public function testBadOptions($name, $value)
7878
{
79-
$this->expectException('ErrorException');
80-
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
79+
if (\PHP_VERSION_ID < 80000) {
80+
$this->expectException('ErrorException');
81+
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
82+
} else {
83+
$this->expectException('Error');
84+
$this->expectExceptionMessage('Undefined class constant \'Memcached::');
85+
}
86+
8187
MemcachedCache::createConnection([], [$name => $value]);
8288
}
8389

0 commit comments

Comments
 (0)
0