Fix some PHP deprecations (#19813)

* Fix PHP 8.5 Reflection*::setAccessible() deprecations

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>

* Fix AuthenticationSignonTest failing test with PHP 8.5

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>

* Fix E_USER_ERROR with trigger_error PHP 8.4 deprecation

Uses E_USER_WARNING instead if PHP >= 8.4. These trigger_error calls
should be replaced with other alternatives in the master branch.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>

---------

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
Maurício Meneghini Fauth 2025-08-19 20:00:47 -03:00 committed by GitHub
commit a2bfa44bba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
58 changed files with 626 additions and 188 deletions

View File

@ -45,6 +45,8 @@ use function trigger_error;
use function urldecode;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION_ID;
final class Common
{
@ -497,7 +499,7 @@ final class Common
__(
'Failed to set session cookie. Maybe you are using HTTP instead of HTTPS to access phpMyAdmin.'
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}

View File

@ -63,6 +63,7 @@ use function trim;
use const ARRAY_FILTER_USE_KEY;
use const DIRECTORY_SEPARATOR;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_OS;
use const PHP_URL_PATH;
use const PHP_URL_SCHEME;
@ -707,7 +708,7 @@ class Config
. __('This usually means there is a syntax error in it, please check any errors shown below.')
. '[br][br]'
. '[conferr]';
trigger_error($error, E_USER_ERROR);
trigger_error($error, PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING);
}
/**
@ -1232,7 +1233,7 @@ class Config
if (! is_int($server_index) || $server_index < 1) {
trigger_error(
sprintf(__('Invalid server index: %s'), $server_index),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}

View File

@ -24,6 +24,8 @@ use function str_replace;
use function trigger_error;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION_ID;
/**
* Base class for forms, loads default configuration options, checks allowed
@ -130,13 +132,19 @@ class Form
{
$value = $this->configFile->getDbEntry($optionPath);
if ($value === null) {
trigger_error($optionPath . ' - select options not defined', E_USER_ERROR);
trigger_error(
$optionPath . ' - select options not defined',
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
return [];
}
if (! is_array($value)) {
trigger_error($optionPath . ' - not a static value list', E_USER_ERROR);
trigger_error(
$optionPath . ' - not a static value list',
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
return [];
}

View File

@ -57,6 +57,7 @@ use const DATE_RFC1123;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const FILTER_VALIDATE_IP;
use const PHP_VERSION_ID;
/**
* Core functions used all over the scripts.
@ -375,7 +376,10 @@ class Core
session_write_close();
if ($response->headersSent()) {
trigger_error('Core::sendHeaderLocation called when headers are already sent!', E_USER_ERROR);
trigger_error(
'Core::sendHeaderLocation called when headers are already sent!',
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}
// bug #1523784: IE6 does not like 'Refresh: 0', it

View File

@ -33,6 +33,7 @@ use const MYSQLI_OPT_SSL_VERIFY_SERVER_CERT;
use const MYSQLI_REPORT_OFF;
use const MYSQLI_STORE_RESULT;
use const MYSQLI_USE_RESULT;
use const PHP_VERSION_ID;
/**
* Interface to the MySQL Improved extension (MySQLi)
@ -167,7 +168,7 @@ class DbiMysqli implements DbiExtension
'[code][doc@cfg_Servers_hide_connection_errors]'
. '$cfg[\'Servers\'][$i][\'hide_connection_errors\'][/doc][/code]'
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}

View File

@ -19,6 +19,8 @@ use function uasort;
use function ucfirst;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION_ID;
/**
* Language selection manager
@ -978,7 +980,7 @@ class LanguageManager
trigger_error(
__('Ignoring unsupported language code.'),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}
}

View File

@ -16,6 +16,8 @@ use function sprintf;
use function trigger_error;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION_ID;
/**
* Node factory - instantiates Node objects or objects derived from the Node class
@ -43,7 +45,7 @@ class NodeFactory
__('Invalid class name "%1$s", using default of "Node"'),
$class
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}
@ -73,7 +75,7 @@ class NodeFactory
__('Could not load class "%1$s"'),
$class
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
}

View File

@ -53,7 +53,9 @@ use function strtoupper;
use function trigger_error;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION;
use const PHP_VERSION_ID;
/**
* Handles the export for the SQL class
@ -1541,7 +1543,7 @@ class ExportSql extends ExportPlugin
$message = sprintf(__('Error reading structure for table %s:'), $db . '.' . $table);
$message .= ' ' . $tmpError;
if (! defined('TESTSUITE')) {
trigger_error($message, E_USER_ERROR);
trigger_error($message, PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING);
}
return $this->exportComment($message);
@ -2270,7 +2272,7 @@ class ExportSql extends ExportPlugin
$message = sprintf(__('Error reading data for table %s:'), $db . '.' . $table);
$message .= ' ' . $tmpError;
if (! defined('TESTSUITE')) {
trigger_error($message, E_USER_ERROR);
trigger_error($message, PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING);
}
return $this->export->outputHandler(

View File

@ -20,8 +20,9 @@ use function trim;
use function version_compare;
use const DIRECTORY_SEPARATOR;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION_ID;
/**
* handles theme
@ -168,7 +169,7 @@ class Theme
__('No valid image path for theme %s found!'),
$this->getName()
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
return false;

View File

@ -18,6 +18,7 @@ use function trigger_error;
use const DIRECTORY_SEPARATOR;
use const E_USER_ERROR;
use const E_USER_WARNING;
use const PHP_VERSION_ID;
/**
* phpMyAdmin theme manager
@ -83,7 +84,7 @@ class ThemeManager
__('Default theme %s not found!'),
htmlspecialchars($GLOBALS['cfg']['ThemeDefault'])
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
$configThemeExists = false;
} else {
@ -142,7 +143,7 @@ class ThemeManager
__('Theme %s not found!'),
htmlspecialchars((string) $theme)
),
E_USER_ERROR
PHP_VERSION_ID < 80400 ? E_USER_ERROR : E_USER_WARNING
);
return false;

View File

@ -1197,7 +1197,7 @@ parameters:
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
count: 2
path: libraries/classes/Config.php
-
@ -1550,11 +1550,6 @@ parameters:
count: 1
path: libraries/classes/Config/Form.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 2
path: libraries/classes/Config/Form.php
-
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 2
@ -36000,11 +35995,6 @@ parameters:
count: 1
path: libraries/classes/Theme.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: libraries/classes/Theme.php
-
message: "#^Cannot access offset 'ThemeDefault' on mixed\\.$#"
count: 3
@ -36050,11 +36040,6 @@ parameters:
count: 1
path: libraries/classes/ThemeManager.php
-
message: "#^If condition is always true\\.$#"
count: 1
path: libraries/classes/ThemeManager.php
-
message: "#^Method PhpMyAdmin\\\\ThemeManager\\:\\:getThemeCookie\\(\\) should return string\\|false but returns mixed\\.$#"
count: 1
@ -36105,11 +36090,6 @@ parameters:
count: 1
path: libraries/classes/ThemeManager.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 2
path: libraries/classes/ThemeManager.php
-
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 1
@ -46420,6 +46400,11 @@ parameters:
count: 6
path: test/classes/Plugins/Auth/AuthenticationHttpTest.php
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with array\\{lifetime\\: 0, path\\: '/', domain\\: '', secure\\: false, partitioned\\?\\: false, httponly\\: false, samesite\\?\\: ''\\} and array\\{lifetime\\: int\\<0, max\\>, path\\: non\\-falsy\\-string, domain\\: string, secure\\: bool, httponly\\: bool, samesite\\: string\\} will always evaluate to false\\.$#"
count: 1
path: test/classes/Plugins/Auth/AuthenticationSignonTest.php
-
message: "#^Cannot access offset 'LoginCookieValidity' on mixed\\.$#"
count: 1

View File

@ -329,7 +329,7 @@
<InvalidArrayOffset occurrences="1">
<code>$cfg['Server']['hide_connection_errors']</code>
</InvalidArrayOffset>
<MixedArgument occurrences="15">
<MixedArgument occurrences="16">
<code>$collation_connection</code>
<code>$config_data</code>
<code>$config_data</code>
@ -340,6 +340,7 @@
<code>$path</code>
<code>$server['verbose']</code>
<code>$server_index</code>
<code>$server_index</code>
<code>$this-&gt;settings['Servers']</code>
<code>$this-&gt;settings['ThemeDefault']</code>
<code>$this-&gt;settings['ThemeDefault']</code>
@ -365,11 +366,12 @@
<code>$_SESSION['cache'][$cache_key]</code>
<code>$temp_dir[$name]</code>
</MixedArrayAssignment>
<MixedArrayOffset occurrences="2">
<MixedArrayOffset occurrences="3">
<code>$new_servers[$server_index]</code>
<code>$this-&gt;settings['Servers'][$server]</code>
<code>$this-&gt;settings['Servers'][$this-&gt;settings['ServerDefault']]</code>
</MixedArrayOffset>
<MixedAssignment occurrences="25">
<MixedAssignment occurrences="26">
<code>$cfg['LoginCookieValidity']</code>
<code>$collation_connection</code>
<code>$config_data</code>
@ -390,6 +392,7 @@
<code>$server['host']</code>
<code>$server['port']</code>
<code>$server[substr($key, 8)]</code>
<code>$server_index</code>
<code>$url</code>
<code>$url</code>
<code>$user</code>
@ -536,8 +539,7 @@
<code>$v</code>
<code>$value</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="2">
<code>array</code>
<MixedInferredReturnType occurrences="1">
<code>string|null</code>
</MixedInferredReturnType>
<MixedOperand occurrences="4">
@ -558,10 +560,6 @@
<code>$fieldsTypes</code>
<code>$name</code>
</PropertyNotSetInConstructor>
<UnevaluatedCode occurrences="2">
<code>return [];</code>
<code>return [];</code>
</UnevaluatedCode>
</file>
<file src="libraries/classes/Config/FormDisplay.php">
<MixedArgument occurrences="20">
@ -13843,9 +13841,6 @@
<code>$data['name']</code>
<code>$data['version']</code>
</MixedArgument>
<UnevaluatedCode occurrences="1">
<code>return false;</code>
</UnevaluatedCode>
</file>
<file src="libraries/classes/ThemeManager.php">
<DocblockTypeContradiction occurrences="2">
@ -13873,16 +13868,9 @@
<code>(bool) $perServer</code>
<code>(string) $this-&gt;theme-&gt;id</code>
</RedundantCastGivenDocblockType>
<RedundantCondition occurrences="1">
<code>$configThemeExists</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="1">
<code>$this-&gt;theme !== null</code>
</RedundantConditionGivenDocblockType>
<UnevaluatedCode occurrences="2">
<code>$configThemeExists = false;</code>
<code>return false;</code>
</UnevaluatedCode>
</file>
<file src="libraries/classes/Tracker.php">
<DocblockTypeContradiction occurrences="1">

View File

@ -20,6 +20,8 @@ use function end;
use function is_array;
use function is_int;
use const PHP_VERSION_ID;
/**
* Base class for phpMyAdmin tests
*/
@ -89,7 +91,10 @@ abstract class AbstractNetworkTestCase extends AbstractTestCase
}
$attrInstance = new ReflectionProperty(ResponseRenderer::class, 'instance');
$attrInstance->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrInstance->setAccessible(true);
}
$attrInstance->setValue(null, $mockResponse);
return $mockResponse;
@ -102,8 +107,15 @@ abstract class AbstractNetworkTestCase extends AbstractTestCase
{
parent::tearDown();
$response = new ReflectionProperty(ResponseRenderer::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, null);
if (PHP_VERSION_ID >= 80100) {
return;
}
$response->setAccessible(false);
}
}

View File

@ -24,6 +24,7 @@ use function in_array;
use function method_exists;
use const DIRECTORY_SEPARATOR;
use const PHP_VERSION_ID;
/**
* Abstract class to hold some usefull methods used in tests
@ -302,7 +303,9 @@ abstract class AbstractTestCase extends TestCase
{
$class = new ReflectionClass($className);
$method = $class->getMethod($methodName);
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
return $method->invokeArgs($object, $params);
}
@ -321,7 +324,9 @@ abstract class AbstractTestCase extends TestCase
{
$class = new ReflectionClass($className);
$property = $class->getProperty($propertyName);
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
return $property->getValue($object);
}

View File

@ -15,6 +15,8 @@ use ReflectionProperty;
use function function_exists;
use function gettype;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Config\FormDisplay
*/
@ -55,7 +57,9 @@ class FormDisplayTest extends AbstractTestCase
$reflection = new ReflectionClass(FormDisplay::class);
$attrForms = $reflection->getProperty('forms');
$attrForms->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrForms->setAccessible(true);
}
$array = [
'Servers' => [
@ -71,7 +75,9 @@ class FormDisplayTest extends AbstractTestCase
self::assertInstanceOf(Form::class, $_forms['pma_testform']);
$attrSystemPaths = $reflection->getProperty('systemPaths');
$attrSystemPaths->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrSystemPaths->setAccessible(true);
}
self::assertSame([
'Servers/2/test' => 'Servers/1/test',
@ -79,7 +85,9 @@ class FormDisplayTest extends AbstractTestCase
], $attrSystemPaths->getValue($this->object));
$attrTranslatedPaths = $reflection->getProperty('translatedPaths');
$attrTranslatedPaths->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrTranslatedPaths->setAccessible(true);
}
self::assertSame([
'Servers/2/test' => 'Servers-2-test',
@ -102,7 +110,10 @@ class FormDisplayTest extends AbstractTestCase
->getMock();
$attrForms = new ReflectionProperty(FormDisplay::class, 'forms');
$attrForms->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrForms->setAccessible(true);
}
$attrForms->setValue($this->object, [1, 2, 3]);
$this->object->expects($this->once())
@ -125,11 +136,17 @@ class FormDisplayTest extends AbstractTestCase
$reflection = new ReflectionClass(FormDisplay::class);
$attrIsValidated = $reflection->getProperty('isValidated');
$attrIsValidated->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrIsValidated->setAccessible(true);
}
$attrIsValidated->setValue($this->object, true);
$attrIsValidated = $reflection->getProperty('errors');
$attrIsValidated->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrIsValidated->setAccessible(true);
}
$attrIsValidated->setValue($this->object, []);
$result = $this->object->displayErrors();
@ -147,7 +164,10 @@ class FormDisplayTest extends AbstractTestCase
$sysArr = ['Servers/1/test' => 'Servers/1/test2'];
$attrSystemPaths = $reflection->getProperty('systemPaths');
$attrSystemPaths->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrSystemPaths->setAccessible(true);
}
$attrSystemPaths->setValue($this->object, $sysArr);
$attrIsValidated->setValue($this->object, $arr);
@ -170,11 +190,17 @@ class FormDisplayTest extends AbstractTestCase
$reflection = new ReflectionClass(FormDisplay::class);
$attrIsValidated = $reflection->getProperty('isValidated');
$attrIsValidated->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrIsValidated->setAccessible(true);
}
$attrIsValidated->setValue($this->object, true);
$attrIsValidated = $reflection->getProperty('errors');
$attrIsValidated->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrIsValidated->setAccessible(true);
}
$attrIsValidated->setValue($this->object, []);
$this->object->fixErrors();
@ -191,7 +217,10 @@ class FormDisplayTest extends AbstractTestCase
$sysArr = ['Servers/1/test' => 'Servers/1/host'];
$attrSystemPaths = $reflection->getProperty('systemPaths');
$attrSystemPaths->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrSystemPaths->setAccessible(true);
}
$attrSystemPaths->setValue($this->object, $sysArr);
$attrIsValidated->setValue($this->object, $arr);
@ -211,7 +240,9 @@ class FormDisplayTest extends AbstractTestCase
public function testValidateSelect(): void
{
$attrValidateSelect = new ReflectionMethod(FormDisplay::class, 'validateSelect');
$attrValidateSelect->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrValidateSelect->setAccessible(true);
}
$arr = ['foo' => 'var'];
$value = 'foo';
@ -261,7 +292,9 @@ class FormDisplayTest extends AbstractTestCase
public function testHasErrors(): void
{
$attrErrors = new ReflectionProperty(FormDisplay::class, 'errors');
$attrErrors->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrErrors->setAccessible(true);
}
self::assertFalse($this->object->hasErrors());
@ -297,7 +330,9 @@ class FormDisplayTest extends AbstractTestCase
public function testGetOptName(): void
{
$method = new ReflectionMethod(FormDisplay::class, 'getOptName');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
self::assertSame('Servers_', $method->invoke($this->object, 'Servers/1/'));
@ -310,11 +345,16 @@ class FormDisplayTest extends AbstractTestCase
public function testLoadUserprefsInfo(): void
{
$method = new ReflectionMethod(FormDisplay::class, 'loadUserprefsInfo');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$attrUserprefs = new ReflectionProperty(FormDisplay::class, 'userprefsDisallow');
$attrUserprefs->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrUserprefs->setAccessible(true);
}
$method->invoke($this->object, null);
self::assertSame([], $attrUserprefs->getValue($this->object));
}
@ -325,7 +365,9 @@ class FormDisplayTest extends AbstractTestCase
public function testSetComments(): void
{
$method = new ReflectionMethod(FormDisplay::class, 'setComments');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
// recoding
$opts = ['values' => []];

View File

@ -13,6 +13,8 @@ use ReflectionProperty;
use function array_keys;
use function preg_match;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Config\Form
*/
@ -68,7 +70,10 @@ class FormTest extends AbstractTestCase
public function testGetOptionType(): void
{
$attrFieldsTypes = new ReflectionProperty(Form::class, 'fieldsTypes');
$attrFieldsTypes->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrFieldsTypes->setAccessible(true);
}
$attrFieldsTypes->setValue(
$this->object,
['7' => 'Seven']
@ -110,7 +115,9 @@ class FormTest extends AbstractTestCase
{
$reflection = new ReflectionClass(Form::class);
$method = $reflection->getMethod('readFormPathsCallback');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$array = [
'foo' => [
@ -146,7 +153,9 @@ class FormTest extends AbstractTestCase
{
$reflection = new ReflectionClass(Form::class);
$method = $reflection->getMethod('readFormPaths');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$array = [
'foo' => [
@ -187,7 +196,9 @@ class FormTest extends AbstractTestCase
{
$reflection = new ReflectionClass(Form::class);
$method = $reflection->getMethod('readTypes');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$this->object->fields = [
'pma_form1' => 'Servers/1/port',
@ -197,7 +208,9 @@ class FormTest extends AbstractTestCase
];
$attrFieldsTypes = $reflection->getProperty('fieldsTypes');
$attrFieldsTypes->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrFieldsTypes->setAccessible(true);
}
$method->invoke($this->object, null);

View File

@ -14,6 +14,7 @@ use function array_keys;
use function mb_strlen;
use function str_repeat;
use const PHP_VERSION_ID;
use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES;
/**
@ -39,7 +40,10 @@ class ServerConfigChecksTest extends AbstractTestCase
$GLOBALS['ConfigFile'] = $cf;
$reflection = new ReflectionProperty(ConfigFile::class, 'id');
$reflection->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$reflection->setAccessible(true);
}
$this->sessionID = $reflection->getValue($cf);
unset($_SESSION['messages']);

View File

@ -14,6 +14,8 @@ use ReflectionClass;
use function implode;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\ConfigStorage\Relation
* @group medium
@ -1939,7 +1941,10 @@ class RelationTest extends AbstractTestCase
$_SESSION['relation'] = [];
$_SESSION['tmpval'] = [];
$recentFavoriteTableInstances = (new ReflectionClass(RecentFavoriteTable::class))->getProperty('instances');
$recentFavoriteTableInstances->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$recentFavoriteTableInstances->setAccessible(true);
}
$recentFavoriteTableInstances->setValue(null, []);
$relation = new Relation($this->dbi);

View File

@ -7,6 +7,8 @@ namespace PhpMyAdmin\Tests;
use PhpMyAdmin\Console;
use ReflectionProperty;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Console
*/
@ -21,7 +23,10 @@ class ConsoleTest extends AbstractTestCase
public function testSetAjax(): void
{
$isAjax = new ReflectionProperty(Console::class, 'isAjax');
$isAjax->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$isAjax->setAccessible(true);
}
$console = new Console();
self::assertFalse($isAjax->getValue($console));

View File

@ -14,6 +14,8 @@ use ReflectionClass;
use function json_encode;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Database\Structure\FavoriteTableController
*/
@ -34,7 +36,9 @@ class FavoriteTableControllerTest extends AbstractTestCase
$class = new ReflectionClass(FavoriteTableController::class);
$method = $class->getMethod('synchronizeFavoriteTables');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$controller = new FavoriteTableController(
new ResponseStub(),

View File

@ -19,6 +19,8 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use ReflectionClass;
use ReflectionException;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Database\StructureController
*/
@ -92,7 +94,10 @@ class StructureControllerTest extends AbstractTestCase
{
$class = new ReflectionClass(StructureController::class);
$method = $class->getMethod('getValuesForInnodbTable');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$controller = new StructureController(
$this->response,
$this->template,
@ -106,7 +111,10 @@ class StructureControllerTest extends AbstractTestCase
);
// Showing statistics
$property = $class->getProperty('isShowStats');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($controller, true);
$GLOBALS['cfg']['MaxExactCount'] = 10;
@ -171,7 +179,9 @@ class StructureControllerTest extends AbstractTestCase
{
$class = new ReflectionClass(StructureController::class);
$method = $class->getMethod('getValuesForAriaTable');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$controller = new StructureController(
$this->response,
@ -186,10 +196,16 @@ class StructureControllerTest extends AbstractTestCase
);
// Showing statistics
$property = $class->getProperty('isShowStats');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($controller, true);
$property = $class->getProperty('dbIsSystemSchema');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($controller, true);
$currentTable = [
@ -287,7 +303,9 @@ class StructureControllerTest extends AbstractTestCase
{
$class = new ReflectionClass(StructureController::class);
$method = $class->getMethod('hasTable');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$controller = new StructureController(
$this->response,
@ -320,7 +338,9 @@ class StructureControllerTest extends AbstractTestCase
{
$class = new ReflectionClass(StructureController::class);
$method = $class->getMethod('checkFavoriteTable');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$GLOBALS['db'] = 'sakila';
$GLOBALS['dbi'] = $this->dbi;
@ -374,7 +394,9 @@ class StructureControllerTest extends AbstractTestCase
{
$class = new ReflectionClass(StructureController::class);
$method = $class->getMethod('displayTableList');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$controller = new StructureController(
$this->response,
@ -390,14 +412,22 @@ class StructureControllerTest extends AbstractTestCase
// Showing statistics
$class = new ReflectionClass(StructureController::class);
$showStatsProperty = $class->getProperty('isShowStats');
$showStatsProperty->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$showStatsProperty->setAccessible(true);
}
$showStatsProperty->setValue($controller, true);
$tablesProperty = $class->getProperty('tables');
$tablesProperty->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$tablesProperty->setAccessible(true);
}
$numTables = $class->getProperty('numTables');
$numTables->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$numTables->setAccessible(true);
}
$numTables->setValue($controller, 1);
//no tables

View File

@ -21,6 +21,8 @@ use function __;
use function htmlspecialchars;
use function str_replace;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Server\VariablesController
*/
@ -137,7 +139,10 @@ class VariablesControllerTest extends AbstractTestCase
->willReturnOnConsecutiveCalls('byte', 'string');
$response = new ReflectionProperty(ServerVariablesProvider::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, $voidProviderMock);
[$formattedValue, $isHtmlFormatted] = $this->callFunction(
@ -189,7 +194,10 @@ class VariablesControllerTest extends AbstractTestCase
}
$response = new ReflectionProperty(ServerVariablesProvider::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, null);
$controller = new VariablesController(ResponseRenderer::getInstance(), new Template(), $GLOBALS['dbi']);
@ -248,7 +256,10 @@ class VariablesControllerTest extends AbstractTestCase
public function testFormatVariableVoidProvider(): void
{
$response = new ReflectionProperty(ServerVariablesProvider::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, new ServerVariablesVoidProvider());
$controller = new VariablesController(ResponseRenderer::getInstance(), new Template(), $GLOBALS['dbi']);

View File

@ -14,13 +14,18 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use ReflectionProperty;
use const PHP_VERSION_ID;
/** @covers \PhpMyAdmin\Controllers\Table\IndexRenameController */
final class IndexRenameControllerTest extends AbstractTestCase
{
public function testPreviewSqlWithOldStatement(): void
{
$indexRegistry = new ReflectionProperty(Index::class, 'registry');
$indexRegistry->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$indexRegistry->setAccessible(true);
}
$indexRegistry->setValue(null, []);
$GLOBALS['cfg']['Server'] = $GLOBALS['cfg']['Servers'][1];

View File

@ -21,6 +21,8 @@ use ReflectionMethod;
use function __;
use function sprintf;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Table\IndexesController
*/
@ -102,7 +104,9 @@ class IndexesControllerTest extends AbstractTestCase
$template = new Template();
$method = new ReflectionMethod(IndexesController::class, 'displayForm');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$ctrl = new IndexesController(
$response,

View File

@ -12,6 +12,8 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use PhpMyAdmin\Transformations;
use ReflectionClass;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Table\Structure\ChangeController
*/
@ -31,7 +33,9 @@ class ChangeControllerTest extends AbstractTestCase
$class = new ReflectionClass(ChangeController::class);
$method = $class->getMethod('displayHtmlForColumnChange');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$ctrl = new ChangeController(
$response,

View File

@ -12,6 +12,8 @@ use ReflectionClass;
use function preg_replace;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Table\Structure\MoveColumnsController
*/
@ -27,7 +29,9 @@ class MoveColumnsControllerTest extends AbstractTestCase
{
$class = new ReflectionClass(MoveColumnsController::class);
$method = $class->getMethod('generateAlterTableSql');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$controller = new MoveColumnsController(
new ResponseStub(),

View File

@ -13,6 +13,8 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use PhpMyAdmin\Transformations;
use ReflectionClass;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Controllers\Table\Structure\SaveController
*/
@ -28,7 +30,9 @@ class SaveControllerTest extends AbstractTestCase
$class = new ReflectionClass(SaveController::class);
$method = $class->getMethod('adjustColumnPrivileges');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$ctrl = new SaveController(
new ResponseStub(),

View File

@ -13,6 +13,8 @@ use PhpMyAdmin\Tests\Stubs\DummyResult;
use PhpMyAdmin\Version;
use ReflectionMethod;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Database\Designer
*/
@ -105,7 +107,10 @@ class DesignerTest extends AbstractTestCase
$this->designer = new Designer($GLOBALS['dbi'], new Relation($GLOBALS['dbi']), new Template());
$method = new ReflectionMethod(Designer::class, 'getPageIdsAndNames');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invokeArgs($this->designer, [$db]);
self::assertSame([

View File

@ -25,6 +25,7 @@ use const E_USER_ERROR;
use const E_USER_NOTICE;
use const E_USER_WARNING;
use const E_WARNING;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\ErrorHandler
@ -317,7 +318,10 @@ class ErrorHandlerTest extends AbstractTestCase
$GLOBALS['config']->set('environment', 'development');
$responseStub = new ResponseRendererStub();
$property = new ReflectionProperty(ResponseRenderer::class, 'instance');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue(null, $responseStub);
$responseStub->setHeadersSent(true);
$errorHandler = new ErrorHandler();
@ -343,7 +347,10 @@ class ErrorHandlerTest extends AbstractTestCase
$GLOBALS['config']->set('environment', 'production');
$responseStub = new ResponseRendererStub();
$property = new ReflectionProperty(ResponseRenderer::class, 'instance');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue(null, $responseStub);
$responseStub->setHeadersSent(true);
$errorHandler = new ErrorHandler();
@ -369,7 +376,10 @@ class ErrorHandlerTest extends AbstractTestCase
$GLOBALS['config']->set('environment', 'production');
$responseStub = new ResponseRendererStub();
$property = new ReflectionProperty(ResponseRenderer::class, 'instance');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue(null, $responseStub);
$responseStub->setHeadersSent(true);
$errorHandler = new ErrorHandler();
@ -395,7 +405,10 @@ HTML;
$GLOBALS['config']->set('environment', 'production');
$responseStub = new ResponseRendererStub();
$property = new ReflectionProperty(ResponseRenderer::class, 'instance');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue(null, $responseStub);
$responseStub->setHeadersSent(false);
$errorHandler = new ErrorHandler();

View File

@ -11,6 +11,8 @@ use ReflectionProperty;
use function json_encode;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Footer
*/
@ -154,7 +156,10 @@ class FooterTest extends AbstractTestCase
public function testSetAjax(): void
{
$isAjax = new ReflectionProperty(Footer::class, 'isAjax');
$isAjax->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$isAjax->setAccessible(true);
}
$footer = new Footer();
self::assertFalse($isAjax->getValue($footer));

View File

@ -12,6 +12,7 @@ use ReflectionProperty;
use function gmdate;
use const DATE_RFC1123;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Header
@ -106,7 +107,9 @@ class HeaderTest extends AbstractTestCase
public function testDisableWarnings(): void
{
$reflection = new ReflectionProperty(Header::class, 'warningsEnabled');
$reflection->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$reflection->setAccessible(true);
}
$header = new Header();
$header->disableWarnings();
@ -233,13 +236,21 @@ class HeaderTest extends AbstractTestCase
{
$header = new Header();
$consoleReflection = new ReflectionProperty(Header::class, 'console');
$consoleReflection->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$consoleReflection->setAccessible(true);
}
$console = $consoleReflection->getValue($header);
self::assertInstanceOf(Console::class, $console);
$isAjax = new ReflectionProperty(Header::class, 'isAjax');
$isAjax->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$isAjax->setAccessible(true);
}
$consoleIsAjax = new ReflectionProperty(Console::class, 'isAjax');
$consoleIsAjax->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$consoleIsAjax->setAccessible(true);
}
self::assertFalse($isAjax->getValue($header));
self::assertFalse($consoleIsAjax->getValue($console));

View File

@ -30,6 +30,7 @@ use const MYSQLI_PRI_KEY_FLAG;
use const MYSQLI_TYPE_DECIMAL;
use const MYSQLI_TYPE_TIMESTAMP;
use const MYSQLI_TYPE_TINY;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\InsertEdit
@ -94,8 +95,15 @@ class InsertEditTest extends AbstractTestCase
{
parent::tearDown();
$response = new ReflectionProperty(ResponseRenderer::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, null);
if (PHP_VERSION_ID >= 80100) {
return;
}
$response->setAccessible(false);
}
@ -312,7 +320,10 @@ class InsertEditTest extends AbstractTestCase
$restoreInstance = ResponseRenderer::getInstance();
$response = new ReflectionProperty(ResponseRenderer::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, $responseMock);
$result = $this->callFunction(
@ -2693,7 +2704,10 @@ class InsertEditTest extends AbstractTestCase
$restoreInstance = ResponseRenderer::getInstance();
$response = new ReflectionProperty(ResponseRenderer::class, 'instance');
$response->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$response->setAccessible(true);
}
$response->setValue(null, $responseMock);
$this->insertEdit = new InsertEdit($dbi);

View File

@ -11,6 +11,8 @@ use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\Tests\Stubs\DummyResult;
use ReflectionMethod;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Navigation\Nodes\Node
*/
@ -221,7 +223,9 @@ class NodeTest extends AbstractTestCase
public function testGetWhereClause(): void
{
$method = new ReflectionMethod(Node::class, 'getWhereClause');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
// Vanilla case
$node = NodeFactory::getInstance();

View File

@ -26,6 +26,7 @@ use function str_repeat;
use function str_shuffle;
use function time;
use const PHP_VERSION_ID;
use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES;
/**
@ -878,7 +879,9 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase
public function testGetEncryptionSecretEmpty(): void
{
$method = new ReflectionMethod(AuthenticationCookie::class, 'getEncryptionSecret');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$GLOBALS['cfg']['blowfish_secret'] = '';
$_SESSION['encryption_key'] = '';
@ -892,7 +895,9 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase
public function testGetEncryptionSecretConfigured(): void
{
$method = new ReflectionMethod(AuthenticationCookie::class, 'getEncryptionSecret');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$key = str_repeat('a', SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
$GLOBALS['cfg']['blowfish_secret'] = $key;
@ -906,7 +911,9 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase
public function testGetSessionEncryptionSecretConfigured(): void
{
$method = new ReflectionMethod(AuthenticationCookie::class, 'getEncryptionSecret');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$key = str_repeat('a', SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
$GLOBALS['cfg']['blowfish_secret'] = 'blowfish_secret';

View File

@ -17,6 +17,8 @@ use function session_id;
use function session_name;
use function version_compare;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Auth\AuthenticationSignon
*/
@ -324,6 +326,7 @@ class AuthenticationSignonTest extends AbstractNetworkTestCase
'path' => '/',
'domain' => '',
'secure' => false,
'partitioned' => false,
'httponly' => false,
'samesite' => '',
];
@ -332,6 +335,10 @@ class AuthenticationSignonTest extends AbstractNetworkTestCase
unset($defaultOptions['samesite']);
}
if (PHP_VERSION_ID < 80500) {
unset($defaultOptions['partitioned']);
}
self::assertSame($defaultOptions, session_get_cookie_params());
}
}

View File

@ -18,6 +18,8 @@ use ReflectionProperty;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportCodegen
* @group medium
@ -49,11 +51,16 @@ class ExportCodegenTest extends AbstractTestCase
public function testInitSpecificVariables(): void
{
$method = new ReflectionMethod(ExportCodegen::class, 'init');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrCgFormats = new ReflectionProperty(ExportCodegen::class, 'cgFormats');
$attrCgFormats->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrCgFormats->setAccessible(true);
}
self::assertSame([
'NHibernate C# DO',
@ -64,11 +71,17 @@ class ExportCodegenTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportCodegen::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportCodegen::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);
@ -185,7 +198,10 @@ class ExportCodegenTest extends AbstractTestCase
public function testHandleNHibernateCSBody(): void
{
$method = new ReflectionMethod(ExportCodegen::class, 'handleNHibernateCSBody');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, 'test_db', 'test_table', "\n");
self::assertSame('using System;' . "\n" .
@ -235,7 +251,10 @@ class ExportCodegenTest extends AbstractTestCase
public function testHandleNHibernateXMLBody(): void
{
$method = new ReflectionMethod(ExportCodegen::class, 'handleNHibernateXMLBody');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, 'test_db', 'test_table', "\n");
self::assertSame('<?xml version="1.0" encoding="utf-8" ?>' . "\n" .
@ -267,8 +286,10 @@ class ExportCodegenTest extends AbstractTestCase
$getter = $reflection->getMethod('getCgFormats');
$setter = $reflection->getMethod('setCgFormats');
$getter->setAccessible(true);
$setter->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$getter->setAccessible(true);
$setter->setAccessible(true);
}
$setter->invoke($this->object, [1, 2]);

View File

@ -19,6 +19,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportCsv
* @group medium
@ -55,11 +57,17 @@ class ExportCsvTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportCsv::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportCsv::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -18,6 +18,8 @@ use ReflectionProperty;
use function array_shift;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportExcel
* @group medium
@ -49,11 +51,17 @@ class ExportExcelTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportExcel::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportExcel::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -24,6 +24,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportHtmlword
* @group medium
@ -66,11 +68,17 @@ class ExportHtmlwordTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportHtmlword::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportHtmlword::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);
@ -529,7 +537,10 @@ class ExportHtmlwordTest extends AbstractTestCase
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod(ExportHtmlword::class, 'getTriggers');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, 'database', 'table');
self::assertStringContainsString('<td class="print">tna&quot;me</td>' .
@ -633,7 +644,9 @@ class ExportHtmlwordTest extends AbstractTestCase
public function testFormatOneColumnDefinition(): void
{
$method = new ReflectionMethod(ExportHtmlword::class, 'formatOneColumnDefinition');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$cols = [
'Null' => 'Yes',

View File

@ -16,6 +16,8 @@ use ReflectionProperty;
use function array_shift;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportJson
* @group medium
@ -52,11 +54,17 @@ class ExportJsonTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportJson::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportJson::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -23,6 +23,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportLatex
* @group medium
@ -76,7 +78,10 @@ class ExportLatexTest extends AbstractTestCase
$_SESSION = ['relation' => [$GLOBALS['server'] => $relationParameters->toArray()]];
$method = new ReflectionMethod(ExportLatex::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$properties = $method->invoke($this->object, null);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -21,6 +21,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportMediawiki
* @group medium
@ -62,11 +64,17 @@ class ExportMediawikiTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportMediawiki::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportMediawiki::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -28,6 +28,7 @@ use const MYSQLI_TYPE_DECIMAL;
use const MYSQLI_TYPE_STRING;
use const MYSQLI_TYPE_TIME;
use const MYSQLI_TYPE_TINY_BLOB;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportOds
@ -66,11 +67,17 @@ class ExportOdsTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportOds::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportOds::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -28,6 +28,7 @@ use const MYSQLI_NUM_FLAG;
use const MYSQLI_TYPE_BLOB;
use const MYSQLI_TYPE_DECIMAL;
use const MYSQLI_TYPE_STRING;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportOdt
@ -82,7 +83,10 @@ class ExportOdtTest extends AbstractTestCase
$_SESSION = ['relation' => [$GLOBALS['server'] => $relationParameters->toArray()]];
$method = new ReflectionMethod(ExportOdt::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$properties = $method->invoke($this->object, null);
self::assertInstanceOf(ExportPluginProperties::class, $properties);
@ -647,7 +651,10 @@ class ExportOdtTest extends AbstractTestCase
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod(ExportOdt::class, 'getTriggers');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, 'database', 'ta<ble');
self::assertSame($result, $GLOBALS['odt_buffer']);
@ -806,7 +813,9 @@ class ExportOdtTest extends AbstractTestCase
public function testFormatOneColumnDefinition(): void
{
$method = new ReflectionMethod(ExportOdt::class, 'formatOneColumnDefinition');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$cols = [
'Null' => 'Yes',

View File

@ -18,6 +18,8 @@ use ReflectionProperty;
use function __;
use function array_shift;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportPdf
* @group medium
@ -54,11 +56,17 @@ class ExportPdfTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportPdf::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportPdf::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);
@ -131,7 +139,10 @@ class ExportPdfTest extends AbstractTestCase
->method('setTopMargin');
$attrPdf = new ReflectionProperty(ExportPdf::class, 'pdf');
$attrPdf->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrPdf->setAccessible(true);
}
$attrPdf->setValue($this->object, $pdf);
self::assertTrue($this->object->exportHeader());
@ -147,7 +158,10 @@ class ExportPdfTest extends AbstractTestCase
->method('getPDFData');
$attrPdf = new ReflectionProperty(ExportPdf::class, 'pdf');
$attrPdf->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrPdf->setAccessible(true);
}
$attrPdf->setValue($this->object, $pdf);
self::assertTrue($this->object->exportFooter());
@ -179,7 +193,10 @@ class ExportPdfTest extends AbstractTestCase
->with('SELECT');
$attrPdf = new ReflectionProperty(ExportPdf::class, 'pdf');
$attrPdf->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrPdf->setAccessible(true);
}
$attrPdf->setValue($this->object, $pdf);
self::assertTrue($this->object->exportData(
@ -199,11 +216,17 @@ class ExportPdfTest extends AbstractTestCase
public function testSetGetPdf(): void
{
$setter = new ReflectionMethod(ExportPdf::class, 'setPdf');
$setter->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$setter->setAccessible(true);
}
$setter->invoke($this->object, new Pdf());
$getter = new ReflectionMethod(ExportPdf::class, 'getPdf');
$getter->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$getter->setAccessible(true);
}
self::assertInstanceOf(Pdf::class, $getter->invoke($this->object));
}
}

View File

@ -17,6 +17,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportPhparray
* @group medium
@ -58,11 +60,17 @@ class ExportPhparrayTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportPhparray::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportPhparray::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -36,6 +36,7 @@ use const MYSQLI_TYPE_FLOAT;
use const MYSQLI_TYPE_LONG;
use const MYSQLI_TYPE_STRING;
use const MYSQLI_UNIQUE_KEY_FLAG;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportSql
@ -88,7 +89,10 @@ class ExportSqlTest extends AbstractTestCase
$GLOBALS['plugin_param']['single_table'] = false;
$method = new ReflectionMethod(ExportSql::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$properties = $method->invoke($this->object, null);
self::assertInstanceOf(ExportPluginProperties::class, $properties);
@ -127,7 +131,10 @@ class ExportSqlTest extends AbstractTestCase
$_SESSION = ['relation' => [$GLOBALS['server'] => $relationParameters->toArray()]];
$method = new ReflectionMethod(ExportSql::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$properties = $method->invoke($this->object, null);
self::assertInstanceOf(ExportPluginProperties::class, $properties);
@ -267,7 +274,9 @@ class ExportSqlTest extends AbstractTestCase
public function testExportComment(): void
{
$method = new ReflectionMethod(ExportSql::class, 'exportComment');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$GLOBALS['crlf'] = '##';
$GLOBALS['sql_include_comments'] = true;
@ -288,7 +297,9 @@ class ExportSqlTest extends AbstractTestCase
public function testPossibleCRLF(): void
{
$method = new ReflectionMethod(ExportSql::class, 'possibleCRLF');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$GLOBALS['crlf'] = '##';
$GLOBALS['sql_include_comments'] = true;
@ -629,7 +640,10 @@ class ExportSqlTest extends AbstractTestCase
$GLOBALS['sql_compatibility'] = 'MSSQL';
$method = new ReflectionMethod(ExportSql::class, 'getTableDefForView');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, 'db', 'view', "\n");
self::assertSame("CREATE TABLE `view`(\n" .
@ -921,7 +935,10 @@ class ExportSqlTest extends AbstractTestCase
$this->object->relation = new Relation($dbi);
$method = new ReflectionMethod(ExportSql::class, 'getTableComments');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, 'db', '', true, true);
self::assertStringContainsString("-- MEDIA TYPES FOR TABLE :\n" .
@ -1001,7 +1018,10 @@ class ExportSqlTest extends AbstractTestCase
));
$result = ob_get_clean();
$sqlViewsProp = new ReflectionProperty(ExportSql::class, 'sqlViews');
$sqlViewsProp->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$sqlViewsProp->setAccessible(true);
}
$sqlViews = $sqlViewsProp->getValue($this->object);
self::assertSame('', $result);
@ -1358,7 +1378,10 @@ class ExportSqlTest extends AbstractTestCase
" \" double NOT NULL DEFAULT '213'\n";
$method = new ReflectionMethod(ExportSql::class, 'makeCreateTableMSSQLCompatible');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$result = $method->invoke($this->object, $query);
self::assertSame("CREATE TABLE (\" datetime DEFAULT NULL,\n" .

View File

@ -22,6 +22,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportTexytext
* @group medium
@ -66,11 +68,17 @@ class ExportTexytextTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportTexytext::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportTexytext::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -20,6 +20,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportXml
* @group medium
@ -63,11 +65,17 @@ class ExportXmlTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportXml::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportXml::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -17,6 +17,8 @@ use function array_shift;
use function ob_get_clean;
use function ob_start;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Plugins\Export\ExportYaml
* @group medium
@ -58,11 +60,17 @@ class ExportYamlTest extends AbstractTestCase
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportYaml::class, 'setProperties');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty(ExportYaml::class, 'properties');
$attrProperties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$attrProperties->setAccessible(true);
}
$properties = $attrProperties->getValue($this->object);
self::assertInstanceOf(ExportPluginProperties::class, $properties);

View File

@ -9,6 +9,8 @@ use PhpMyAdmin\Tests\AbstractTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionProperty;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Properties\Options\OptionsPropertyGroup
*/
@ -38,7 +40,9 @@ class OptionsPropertyGroupTest extends AbstractTestCase
public function testAddProperty(): void
{
$properties = new ReflectionProperty(OptionsPropertyGroup::class, 'properties');
$properties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$properties->setAccessible(true);
}
$properties->setValue($this->stub, [1, 2, 3]);
@ -56,7 +60,9 @@ class OptionsPropertyGroupTest extends AbstractTestCase
public function testRemoveProperty(): void
{
$properties = new ReflectionProperty(OptionsPropertyGroup::class, 'properties');
$properties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$properties->setAccessible(true);
}
$properties->setValue($this->stub, [1, 2, 'test', 3]);
$this->stub->removeProperty('test');
@ -76,7 +82,10 @@ class OptionsPropertyGroupTest extends AbstractTestCase
public function testGetProperties(): void
{
$properties = new ReflectionProperty(OptionsPropertyGroup::class, 'properties');
$properties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$properties->setAccessible(true);
}
$properties->setValue($this->stub, [1, 2, 3]);
self::assertSame([
@ -89,7 +98,10 @@ class OptionsPropertyGroupTest extends AbstractTestCase
public function testGetNrOfProperties(): void
{
$properties = new ReflectionProperty(OptionsPropertyGroup::class, 'properties');
$properties->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$properties->setAccessible(true);
}
$properties->setValue($this->stub, [1, 2, 3]);
self::assertSame(3, $this->stub->getNrOfProperties());

View File

@ -9,6 +9,8 @@ use PhpMyAdmin\Header;
use PhpMyAdmin\ResponseRenderer;
use ReflectionProperty;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\ResponseRenderer
*/
@ -34,13 +36,21 @@ class ResponseRendererTest extends AbstractTestCase
$response = ResponseRenderer::getInstance();
$header = $response->getHeader();
$footerReflection = new ReflectionProperty(ResponseRenderer::class, 'footer');
$footerReflection->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$footerReflection->setAccessible(true);
}
$footer = $footerReflection->getValue($response);
self::assertInstanceOf(Footer::class, $footer);
$headerIsAjax = new ReflectionProperty(Header::class, 'isAjax');
$headerIsAjax->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$headerIsAjax->setAccessible(true);
}
$footerIsAjax = new ReflectionProperty(Footer::class, 'isAjax');
$footerIsAjax->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$footerIsAjax->setAccessible(true);
}
self::assertFalse($response->isAjax());
self::assertFalse($headerIsAjax->getValue($header));

View File

@ -10,6 +10,8 @@ use ReflectionProperty;
use function rawurlencode;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Scripts
*/
@ -91,7 +93,9 @@ class ScriptsTest extends AbstractTestCase
public function testAddFile(): void
{
$reflection = new ReflectionProperty(Scripts::class, 'files');
$reflection->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$reflection->setAccessible(true);
}
// Assert empty _files property of
// Scripts
@ -117,7 +121,9 @@ class ScriptsTest extends AbstractTestCase
public function testAddFiles(): void
{
$reflection = new ReflectionProperty(Scripts::class, 'files');
$reflection->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$reflection->setAccessible(true);
}
$filenames = [
'common.js',

View File

@ -30,6 +30,8 @@ use function htmlspecialchars;
use function implode;
use function preg_quote;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Server\Privileges
*/
@ -1669,7 +1671,9 @@ class PrivilegesTest extends AbstractTestCase
new Plugins($this->dbi)
);
$method = new ReflectionMethod(Privileges::class, 'getUserPrivileges');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
/** @var array|null $actual */
$actual = $method->invokeArgs($serverPrivileges, ['test.user', 'test.host', true]);

View File

@ -15,6 +15,7 @@ use function hex2bin;
use function mb_strlen;
use function str_repeat;
use const PHP_VERSION_ID;
use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES;
/**
@ -74,7 +75,9 @@ class ConfigGeneratorTest extends AbstractTestCase
{
$reflection = new ReflectionClass(ConfigGenerator::class);
$method = $reflection->getMethod('getVarExport');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
self::assertSame('$cfg[\'var_name\'] = 1;' . "\n", $method->invoke(null, 'var_name', 1, "\n"));
@ -108,7 +111,9 @@ class ConfigGeneratorTest extends AbstractTestCase
{
$reflection = new ReflectionClass(ConfigGenerator::class);
$method = $reflection->getMethod('getVarExport');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
self::assertSame(
'$cfg[\'blowfish_secret\'] = \sodium_hex2bin(\''
@ -134,7 +139,9 @@ class ConfigGeneratorTest extends AbstractTestCase
{
$reflection = new ReflectionClass(ConfigGenerator::class);
$method = $reflection->getMethod('isZeroBasedArray');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
self::assertFalse($method->invoke(
null,
@ -175,7 +182,9 @@ class ConfigGeneratorTest extends AbstractTestCase
{
$reflection = new ReflectionClass(ConfigGenerator::class);
$method = $reflection->getMethod('exportZeroBasedArray');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$arr = [
1,

View File

@ -18,6 +18,7 @@ use stdClass;
use const MYSQLI_TYPE_SHORT;
use const MYSQLI_TYPE_TIMESTAMP;
use const MYSQLI_TYPE_VAR_STRING;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Sql
@ -760,7 +761,10 @@ class SqlTest extends AbstractTestCase
public function testGetDetailedProfilingStatsWithoutData(): void
{
$method = new ReflectionMethod($this->sql, 'getDetailedProfilingStats');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
self::assertSame(
['total_time' => 0, 'states' => [], 'chart' => [], 'profile' => []],
$method->invoke($this->sql, [])
@ -770,7 +774,10 @@ class SqlTest extends AbstractTestCase
public function testGetDetailedProfilingStatsWithData(): void
{
$method = new ReflectionMethod($this->sql, 'getDetailedProfilingStats');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$profiling = [
['Status' => 'Starting', 'Duration' => '0.000017'],
['Status' => 'checking permissions', 'Duration' => '0.000003'],

View File

@ -12,6 +12,8 @@ use PhpMyAdmin\Tracker;
use PhpMyAdmin\Util;
use ReflectionMethod;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Tracker
*/
@ -331,7 +333,10 @@ class TrackerTest extends AbstractTestCase
if ($type === null) {
$method = new ReflectionMethod(Tracker::class, 'changeTracking');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$method->invoke(null, $dbname, $tablename, $version, $new_state);
} elseif ($type === 'activate') {
Tracker::activateTracking($dbname, $tablename, $version);

View File

@ -13,6 +13,8 @@ use function parse_str;
use function str_repeat;
use function urldecode;
use const PHP_VERSION_ID;
/**
* @covers \PhpMyAdmin\Url
*/
@ -246,7 +248,10 @@ class UrlTest extends AbstractTestCase
public function testGetArgSeparator(string $expected, $iniValue, ?string $cacheValue): void
{
$property = new ReflectionProperty(Url::class, 'inputArgSeparator');
$property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue(null, $cacheValue);
self::$inputArgSeparator = $iniValue;