Merge pull request #661 from arshidkv12/php85

Fix(reflection): avoid deprecated setAccessible() in PHP 8.5+
api-security
n0nag0n 2 weeks ago committed by GitHub
commit c7533d995f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -128,7 +128,9 @@ class PdoWrapperTest extends TestCase
// Testing protected method using reflection // Testing protected method using reflection
$reflection = new ReflectionClass($this->pdo_wrapper); $reflection = new ReflectionClass($this->pdo_wrapper);
$method = $reflection->getMethod('pullDataFromDsn'); $method = $reflection->getMethod('pullDataFromDsn');
$method->setAccessible(true); if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
// Test SQLite DSN // Test SQLite DSN
$sqliteDsn = 'sqlite::memory:'; $sqliteDsn = 'sqlite::memory:';
@ -205,7 +207,9 @@ class PdoWrapperTest extends TestCase
// Verify metrics are reset after logging // Verify metrics are reset after logging
$reflection = new ReflectionClass($trackingPdo); $reflection = new ReflectionClass($trackingPdo);
$property = $reflection->getProperty('queryMetrics'); $property = $reflection->getProperty('queryMetrics');
$property->setAccessible(true); if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$this->assertCount(0, $property->getValue($trackingPdo)); $this->assertCount(0, $property->getValue($trackingPdo));
} }
} }

Loading…
Cancel
Save