From bb5daa9d09031275646e538e47b2380aad7e727a Mon Sep 17 00:00:00 2001 From: Worma Date: Fri, 1 Aug 2025 06:47:28 +0200 Subject: [PATCH] setAccessible() has no effect as of PHP 8.1 --- src/Tracing/Doctrine/DBAL/ConnectionConfigurator.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Tracing/Doctrine/DBAL/ConnectionConfigurator.php b/src/Tracing/Doctrine/DBAL/ConnectionConfigurator.php index 2f581422..a07cc612 100644 --- a/src/Tracing/Doctrine/DBAL/ConnectionConfigurator.php +++ b/src/Tracing/Doctrine/DBAL/ConnectionConfigurator.php @@ -39,8 +39,12 @@ public function __construct(TracingDriverMiddleware $tracingDriverMiddleware) public function configure(Connection $connection): void { $reflectionProperty = new \ReflectionProperty($connection, '_driver'); - $reflectionProperty->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $reflectionProperty->setAccessible(true); + } $reflectionProperty->setValue($connection, $this->tracingDriverMiddleware->wrap($reflectionProperty->getValue($connection))); - $reflectionProperty->setAccessible(false); + if (\PHP_VERSION_ID < 80100) { + $reflectionProperty->setAccessible(false); + } } }