From 0ade0ba75140afa36e73aea3eb8f2d2526069bb3 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Sat, 28 Feb 2026 20:02:20 +0000 Subject: [PATCH] Fix #20195 Signed-off-by: Kamil Tekiela --- .../Controllers/Table/ChartController.php | 2 +- libraries/classes/Dbal/MysqliResult.php | 3 +- libraries/classes/Dbal/ResultInterface.php | 3 +- phpstan-baseline.neon | 104 +++++++++++++++++- psalm-baseline.xml | 80 ++++++++++++-- 5 files changed, 177 insertions(+), 15 deletions(-) diff --git a/libraries/classes/Controllers/Table/ChartController.php b/libraries/classes/Controllers/Table/ChartController.php index 12a26cd7a2..a73bd49836 100644 --- a/libraries/classes/Controllers/Table/ChartController.php +++ b/libraries/classes/Controllers/Table/ChartController.php @@ -216,7 +216,7 @@ class ChartController extends AbstractController $tmp_row = []; foreach ($data_row as $data_column => $data_value) { $escaped_value = $data_value === null ? null : htmlspecialchars($data_value); - $tmp_row[htmlspecialchars($data_column)] = $escaped_value; + $tmp_row[htmlspecialchars((string) $data_column)] = $escaped_value; } $sanitized_data[] = $tmp_row; diff --git a/libraries/classes/Dbal/MysqliResult.php b/libraries/classes/Dbal/MysqliResult.php index a40c711049..c71f1b08ef 100644 --- a/libraries/classes/Dbal/MysqliResult.php +++ b/libraries/classes/Dbal/MysqliResult.php @@ -112,7 +112,8 @@ final class MysqliResult implements ResultInterface /** * Returns all rows of the result * - * @return array> + * @return array> + * @psalm-return list> */ public function fetchAllAssoc(): array { diff --git a/libraries/classes/Dbal/ResultInterface.php b/libraries/classes/Dbal/ResultInterface.php index 72092082c1..d330c791ce 100644 --- a/libraries/classes/Dbal/ResultInterface.php +++ b/libraries/classes/Dbal/ResultInterface.php @@ -52,7 +52,8 @@ interface ResultInterface extends IteratorAggregate /** * Returns all rows of the result * - * @return array> + * @return array> + * @psalm-return list> */ public function fetchAllAssoc(): array; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f923436a0b..cc60e82dd2 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2816,7 +2816,7 @@ parameters: path: libraries/classes/ConfigStorage/Relation.php - - message: "#^Method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getForeignData\\(\\) should return array\\{foreign_link\\: bool, the_total\\: mixed, foreign_display\\: string, disp_row\\: array\\\\|null, foreign_field\\: mixed\\} but returns array\\{foreign_link\\: bool, the_total\\: mixed, foreign_display\\: string, disp_row\\: array\\\\>\\|null, foreign_field\\: mixed\\}\\.$#" + message: "#^Method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getForeignData\\(\\) should return array\\{foreign_link\\: bool, the_total\\: mixed, foreign_display\\: string, disp_row\\: array\\\\|null, foreign_field\\: mixed\\} but returns array\\{foreign_link\\: bool, the_total\\: mixed, foreign_display\\: string, disp_row\\: array\\\\>\\|null, foreign_field\\: mixed\\}\\.$#" count: 1 path: libraries/classes/ConfigStorage/Relation.php @@ -15521,12 +15521,12 @@ parameters: path: libraries/classes/Dbal/MysqliResult.php - - message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:fetchAllAssoc\\(\\) should return array\\\\> but returns array\\.$#" + message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:fetchAllAssoc\\(\\) should return array\\\\> but returns array\\.$#" count: 1 path: libraries/classes/Dbal/MysqliResult.php - - message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:fetchAllAssoc\\(\\) should return array\\\\> but returns array\\, array\\\\>\\.$#" + message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:fetchAllAssoc\\(\\) should return array\\\\> but returns array\\, array\\\\>\\.$#" count: 1 path: libraries/classes/Dbal/MysqliResult.php @@ -40660,11 +40660,24 @@ parameters: count: 1 path: test/classes/AbstractNetworkTestCase.php + - + message: """ + #^Call to deprecated method assertRegExp\\(\\) of class PHPUnit\\\\Framework\\\\Assert\\: + https\\://github\\.com/sebastianbergmann/phpunit/issues/4086$# + """ + count: 1 + path: test/classes/AbstractTestCase.php + - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" count: 2 path: test/classes/AbstractTestCase.php + - + message: "#^Call to function method_exists\\(\\) with 'PHPUnit\\\\\\\\Framework\\\\\\\\TestCase' and 'assertMatchesRegula…' will always evaluate to true\\.$#" + count: 1 + path: test/classes/AbstractTestCase.php + - message: "#^Cannot call method get\\(\\) on mixed\\.$#" count: 5 @@ -40935,6 +40948,11 @@ parameters: count: 2 path: test/classes/Command/TwigLintCommandTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 1 + path: test/classes/Command/WriteGitRevisionCommandTest.php + - message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:markTestSkipped\\(\\)\\.$#" count: 1 @@ -41300,6 +41318,11 @@ parameters: count: 1 path: test/classes/Config/SettingsTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 4 + path: test/classes/ConfigStorage/RelationCleanupTest.php + - message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:equalTo\\(\\)\\.$#" count: 32 @@ -41480,6 +41503,11 @@ parameters: count: 6 path: test/classes/ConfigStorage/RelationTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 1 + path: test/classes/ConfigStorage/UserGroupsTest.php + - message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:equalTo\\(\\)\\.$#" count: 2 @@ -41515,6 +41543,22 @@ parameters: count: 3 path: test/classes/ConfigStorage/UserGroupsTest.php + - + message: """ + #^Call to deprecated method expectError\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\: + https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$# + """ + count: 1 + path: test/classes/ConfigTest.php + + - + message: """ + #^Call to deprecated method expectErrorMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\: + https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$# + """ + count: 1 + path: test/classes/ConfigTest.php + - message: "#^Cannot access offset 'ProxyUrl' on mixed\\.$#" count: 1 @@ -45765,6 +45809,22 @@ parameters: count: 1 path: test/classes/Navigation/NavigationTreeTest.php + - + message: """ + #^Call to deprecated method expectError\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\: + https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$# + """ + count: 2 + path: test/classes/Navigation/NodeFactoryTest.php + + - + message: """ + #^Call to deprecated method expectErrorMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\: + https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$# + """ + count: 2 + path: test/classes/Navigation/NodeFactoryTest.php + - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array\\{text\\: array\\{route\\: string, params\\: array\\\\}, icon\\: array\\{route\\: string, params\\: array\\\\}, second_icon\\?\\: array\\{route\\: string, params\\: array\\\\}, title\\?\\: string\\} will always evaluate to true\\.$#" count: 1 @@ -46615,6 +46675,11 @@ parameters: count: 4 path: test/classes/Plugins/Export/ExportPdfTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 2 + path: test/classes/Plugins/Export/ExportSqlTest.php + - message: "#^Cannot access offset 'DisableIS' on mixed\\.$#" count: 8 @@ -47295,6 +47360,11 @@ parameters: count: 3 path: test/classes/Server/PluginsTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 4 + path: test/classes/Server/Privileges/AccountLockingTest.php + - message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:equalTo\\(\\)\\.$#" count: 12 @@ -47315,6 +47385,11 @@ parameters: count: 18 path: test/classes/Server/Privileges/AccountLockingTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 1 + path: test/classes/Server/PrivilegesTest.php + - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNull\\(\\) with null will always evaluate to true\\.$#" count: 1 @@ -48260,6 +48335,11 @@ parameters: count: 1 path: test/classes/ThemeTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 1 + path: test/classes/TrackerTest.php + - message: "#^Cannot access offset 'DisableIS' on mixed\\.$#" count: 1 @@ -48850,6 +48930,11 @@ parameters: count: 1 path: test/classes/UserPreferencesTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 4 + path: test/classes/UtilTest.php + - message: "#^Cannot access offset 'AllowThirdPartyFram…' on mixed\\.$#" count: 1 @@ -49180,6 +49265,11 @@ parameters: count: 2 path: test/classes/Utils/SessionCacheTest.php + - + message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" + count: 4 + path: test/classes/VersionInformationTest.php + - message: "#^Cannot access offset 'Servers' on mixed\\.$#" count: 4 @@ -49425,6 +49515,14 @@ parameters: count: 8 path: test/selenium/TestBase.php + - + message: """ + #^Fetching deprecated class constant CAPABILITY_W3C of class Facebook\\\\WebDriver\\\\Chrome\\\\ChromeOptions\\: + Use CAPABILITY instead$# + """ + count: 1 + path: test/selenium/TestBase.php + - message: "#^Method PhpMyAdmin\\\\Tests\\\\Selenium\\\\TestBase\\:\\:waitForElement\\(\\) should return Facebook\\\\WebDriver\\\\Remote\\\\RemoteWebElement but returns mixed\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 617280f3ef..1b456433df 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -5969,11 +5969,11 @@ is_array($row) ? $row : [] - array<int, array<string,string|null>> array<int, string|null> array<int,string|null> array<string, string|null> array<string,string|null> + list<array<array-key, string|null>> $field->flags @@ -12924,7 +12924,7 @@ $arrInstance[$name] $arrInstance[$name] - + $arrInstance[$name] $arrProp $arrWEBMCol @@ -12938,7 +12938,6 @@ $mem['SwapUsed'] $name $objItem - $objLocator $objWEBM $propItem $sum @@ -12947,8 +12946,7 @@ $value $value - - ConnectServer + Instances_ @@ -12968,10 +12966,10 @@ Get - - $this->wmi - COM|null - + + ConnectServer + Get + @@ -14672,6 +14670,11 @@ $filesInfos + + + withConsecutive + + assertFalse @@ -14767,6 +14770,12 @@ + + withConsecutive + withConsecutive + withConsecutive + withConsecutive + $dbi @@ -14798,7 +14807,16 @@ assertSame + + + withConsecutive + + + + expectError + expectErrorMessage + array array @@ -15637,6 +15655,14 @@ array + + + expectError + expectError + expectErrorMessage + expectErrorMessage + + assertIsArray @@ -15957,6 +15983,10 @@ + + withConsecutive + withConsecutive + $GLOBALS['sql_constraints'] @@ -16162,7 +16192,18 @@ assertIsArray + + + withConsecutive + withConsecutive + withConsecutive + withConsecutive + + + + withConsecutive + $export $extra_data['new_privileges'] @@ -16318,6 +16359,9 @@ + + array<int, array<string,string|null>> + $this->link->fetchAssoc($this->result) ?? [] $this->link->fetchRow($this->result) ?? [] @@ -16398,6 +16442,9 @@ + + withConsecutive + $result @@ -16468,6 +16515,12 @@ + + withConsecutive + withConsecutive + withConsecutive + withConsecutive + $_SESSION['cache']['server_server'] $_SESSION['cache']['server_server'] @@ -16575,6 +16628,12 @@ + + withConsecutive + withConsecutive + withConsecutive + withConsecutive + $_SESSION['cache']['version_check'] @@ -16618,6 +16677,9 @@ + + ChromeOptions::CAPABILITY_W3C + $this->webDriver === null