Merge pull request #19753 from MauricioFauth/strict-comparisons

Make some comparisons stricter
This commit is contained in:
Maurício Meneghini Fauth 2025-07-07 16:31:34 -03:00 committed by GitHub
commit de50d366ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
68 changed files with 298 additions and 589 deletions

View File

@ -237,7 +237,7 @@ parameters:
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
count: 1
path: src/Advisory/Advisor.php
-
@ -495,18 +495,6 @@ parameters:
count: 3
path: src/Config.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 2
path: src/Config.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Config.php
-
message: '#^Method PhpMyAdmin\\Config\:\:getChangeLogFilePath\(\) should return string but returns mixed\.$#'
identifier: return.type
@ -642,12 +630,6 @@ parameters:
count: 5
path: src/Config/ConfigFile.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Config/ConfigFile.php
-
message: '#^Method PhpMyAdmin\\Config\\ConfigFile\:\:getCanonicalPath\(\) should return string but returns string\|null\.$#'
identifier: return.type
@ -1078,9 +1060,9 @@ parameters:
path: src/Config/PageSettings.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
count: 1
path: src/Config/PageSettings.php
-
@ -1095,12 +1077,6 @@ parameters:
count: 4
path: src/Config/ServerConfigChecks.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Config/ServerConfigChecks.php
-
message: '#^Only booleans are allowed in &&, mixed given on the left side\.$#'
identifier: booleanAnd.leftNotBoolean
@ -1476,18 +1452,6 @@ parameters:
count: 1
path: src/ConfigStorage/Relation.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/ConfigStorage/Relation.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 21
path: src/ConfigStorage/Relation.php
-
message: '#^Method PhpMyAdmin\\ConfigStorage\\Relation\:\:getChildReferences\(\) should return array\<list\<array\<mixed\>\>\> but returns array\<mixed\>\.$#'
identifier: return.type
@ -1698,6 +1662,12 @@ parameters:
count: 2
path: src/ConfigStorage/Relation.php
-
message: '#^Strict comparison using \!\=\= between array\<string\|null\> and '''' will always evaluate to true\.$#'
identifier: notIdentical.alwaysTrue
count: 1
path: src/ConfigStorage/Relation.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
@ -1812,12 +1782,6 @@ parameters:
count: 1
path: src/Controllers/Database/DesignerController.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Controllers/Database/DesignerController.php
-
message: '#^Parameter \#1 \$db of method PhpMyAdmin\\Database\\Designer\:\:getHtmlForEditOrDeletePages\(\) expects string, string\|null given\.$#'
identifier: argument.type
@ -2103,12 +2067,6 @@ parameters:
count: 1
path: src/Controllers/Database/Structure/EmptyTableController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Controllers/Database/Structure/FavoriteTableController.php
-
message: '#^Cannot cast mixed to string\.$#'
identifier: cast.string
@ -2181,12 +2139,6 @@ parameters:
count: 2
path: src/Controllers/Database/StructureController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Controllers/Database/StructureController.php
-
message: '#^Method PhpMyAdmin\\Controllers\\Database\\StructureController\:\:getStuffForEngineTypeTable\(\) should return array\{array\<mixed\>, string, string, string, string, int, bool, int\} but returns array\{mixed, mixed, mixed, mixed, mixed, mixed, bool, mixed\}\.$#'
identifier: return.type
@ -2397,16 +2349,10 @@ parameters:
count: 5
path: src/Controllers/HomeController.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Controllers/HomeController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 6
count: 1
path: src/Controllers/HomeController.php
-
@ -2469,12 +2415,6 @@ parameters:
count: 2
path: src/Controllers/Import/ImportController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Controllers/Import/ImportController.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
@ -2487,6 +2427,12 @@ parameters:
count: 1
path: src/Controllers/Import/ImportController.php
-
message: '#^Result of && is always false\.$#'
identifier: booleanAnd.alwaysFalse
count: 1
path: src/Controllers/Import/ImportController.php
-
message: '#^Result of \|\| is always true\.$#'
identifier: booleanOr.alwaysTrue
@ -2517,6 +2463,12 @@ parameters:
count: 1
path: src/Controllers/Import/ImportController.php
-
message: '#^Strict comparison using \=\=\= between int and \*NEVER\* will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: src/Controllers/Import/ImportController.php
-
message: '#^Cannot access offset ''go_back_url'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
@ -2613,12 +2565,6 @@ parameters:
count: 1
path: src/Controllers/Operations/DatabaseController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Controllers/Operations/DatabaseController.php
-
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
@ -3357,12 +3303,6 @@ parameters:
count: 2
path: src/Controllers/Table/FindReplaceController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Controllers/Table/FindReplaceController.php
-
message: '#^Parameter \#1 \$identifier of static method PhpMyAdmin\\Util\:\:backquote\(\) expects string\|Stringable\|null, mixed given\.$#'
identifier: argument.type
@ -3597,12 +3537,6 @@ parameters:
count: 6
path: src/Controllers/Table/ReplaceController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Controllers/Table/ReplaceController.php
-
message: '#^Method PhpMyAdmin\\Controllers\\Table\\ReplaceController\:\:getParamsForUpdateOrInsert\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
@ -3615,6 +3549,12 @@ parameters:
count: 1
path: src/Controllers/Table/ReplaceController.php
-
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
identifier: if.condNotBoolean
count: 1
path: src/Controllers/Table/ReplaceController.php
-
message: '#^PHPDoc tag @var for variable \$relationFields has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
@ -3723,12 +3663,6 @@ parameters:
count: 1
path: src/Controllers/Table/SearchController.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Controllers/Table/SearchController.php
-
message: '#^Parameter \#1 \$column of method PhpMyAdmin\\Controllers\\Table\\SearchController\:\:getColumnMinMax\(\) expects string, mixed given\.$#'
identifier: argument.type
@ -4224,7 +4158,13 @@ parameters:
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 5
count: 2
path: src/Controllers/Table/ZoomSearchController.php
-
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
count: 1
path: src/Controllers/Table/ZoomSearchController.php
-
@ -4335,12 +4275,6 @@ parameters:
count: 2
path: src/Controllers/Triggers/IndexController.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Controllers/VersionCheckController.php
-
message: '#^Binary operation "\." between "\\r\\n \(" and mixed results in an error\.$#'
identifier: binaryOp.invalid
@ -4776,12 +4710,6 @@ parameters:
count: 11
path: src/Database/CentralColumns.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Database/CentralColumns.php
-
message: '#^Method PhpMyAdmin\\Database\\CentralColumns\:\:findExistingColNames\(\) should return array\<string\> but returns list\<string\|null\>\.$#'
identifier: return.type
@ -4956,12 +4884,6 @@ parameters:
count: 1
path: src/Database/Designer/Common.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Database/Designer/Common.php
-
message: '#^Only booleans are allowed in a negated boolean, PhpMyAdmin\\Dbal\\ResultInterface\|false given\.$#'
identifier: booleanNot.exprNotBoolean
@ -5352,12 +5274,6 @@ parameters:
count: 4
path: src/Database/Search.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Database/Search.php
-
message: '#^Property PhpMyAdmin\\Database\\Search\:\:\$criteriaTables \(array\<string\>\) does not accept array\<mixed\>\.$#'
identifier: assign.propertyType
@ -5436,12 +5352,6 @@ parameters:
count: 1
path: src/Dbal/DatabaseInterface.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Dbal/DatabaseInterface.php
-
message: '#^Method PhpMyAdmin\\Dbal\\DatabaseInterface\:\:getColumnNames\(\) should return list\<string\> but returns list\<string\|null\>\.$#'
identifier: return.type
@ -5847,18 +5757,6 @@ parameters:
count: 23
path: src/Display/Results.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 6
path: src/Display/Results.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 3
path: src/Display/Results.php
-
message: '#^Method PhpMyAdmin\\Display\\Results\:\:getSortByKeyDropDown\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
@ -5898,7 +5796,7 @@ parameters:
-
message: '#^Only booleans are allowed in a negated boolean, mixed given\.$#'
identifier: booleanNot.exprNotBoolean
count: 4
count: 5
path: src/Display/Results.php
-
@ -6108,12 +6006,6 @@ parameters:
count: 1
path: src/Encoding.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 2
path: src/Encoding.php
-
message: '#^Method PhpMyAdmin\\Encoding\:\:convertString\(\) should return string but returns string\|false\.$#'
identifier: return.type
@ -6354,12 +6246,6 @@ parameters:
count: 2
path: src/Error/ErrorReport.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Error/ErrorReport.php
-
message: '#^Only booleans are allowed in a negated boolean, int given\.$#'
identifier: booleanNot.exprNotBoolean
@ -6459,12 +6345,6 @@ parameters:
count: 4
path: src/Export/Export.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Export/Export.php
-
message: '#^Method PhpMyAdmin\\Export\\Export\:\:compress\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
@ -6675,12 +6555,6 @@ parameters:
count: 1
path: src/Favorites/RecentFavoriteTables.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/FieldMetadata.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@ -6738,12 +6612,6 @@ parameters:
count: 2
path: src/File.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/File.php
-
message: '#^Method PhpMyAdmin\\File\:\:getCompression\(\) should return string but returns string\|false\.$#'
identifier: return.type
@ -7413,13 +7281,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 3
path: src/Git.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
count: 2
path: src/Git.php
-
@ -7605,12 +7467,6 @@ parameters:
count: 7
path: src/Html/Generator.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Html/Generator.php
-
message: '#^Only booleans are allowed in an if condition, string\|false given\.$#'
identifier: if.condNotBoolean
@ -7926,18 +7782,6 @@ parameters:
count: 1
path: src/Import/Import.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Import/Import.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Import/Import.php
-
message: '#^Only booleans are allowed in &&, PhpMyAdmin\\Dbal\\ResultInterface\|false given on the left side\.$#'
identifier: booleanAnd.leftNotBoolean
@ -8385,12 +8229,6 @@ parameters:
count: 4
path: src/Menu.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 3
path: src/Menu.php
-
message: '#^Method PhpMyAdmin\\Menu\:\:getAllowedTabs\(\) should return array\<mixed\> but returns mixed\.$#'
identifier: return.type
@ -8481,7 +8319,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 2
count: 1
path: src/Navigation/NavigationTree.php
-
@ -8631,12 +8469,6 @@ parameters:
count: 4
path: src/Navigation/Nodes/Node.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Navigation/Nodes/Node.php
-
message: '#^Method PhpMyAdmin\\Navigation\\Nodes\\Node\:\:getDatabasesToSearch\(\) should return array\<mixed\> but returns list\<string\>\|string\.$#'
identifier: return.type
@ -8844,7 +8676,7 @@ parameters:
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
count: 1
path: src/Normalization.php
-
@ -9051,18 +8883,6 @@ parameters:
count: 8
path: src/Operations.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Operations.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 3
path: src/Operations.php
-
message: '#^Parameter \#1 \$collation of static method PhpMyAdmin\\Util\:\:getCharsetQueryPart\(\) expects string, mixed given\.$#'
identifier: argument.type
@ -9378,7 +9198,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 2
count: 1
path: src/Plugins.php
-
@ -9453,12 +9273,6 @@ parameters:
count: 1
path: src/Plugins/Auth/AuthenticationConfig.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Plugins/Auth/AuthenticationConfig.php
-
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
identifier: foreach.nonIterable
@ -9516,12 +9330,6 @@ parameters:
count: 1
path: src/Plugins/Auth/AuthenticationCookie.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Plugins/Auth/AuthenticationCookie.php
-
message: '#^Offset ''CaptchaSiteVerifyURL'' on array\{PmaAbsoluteUri\: string, AuthLog\: string, AuthLogSuccess\: bool, PmaNoRelation_DisableWarning\: bool, SuhosinDisableWarning\: bool, LoginCookieValidityDisableWarning\: bool, ReservedWordDisableWarning\: bool, TranslationWarningThreshold\: int, \.\.\.\} on left side of \?\? always exists and is not nullable\.$#'
identifier: nullCoalesce.offset
@ -9663,12 +9471,6 @@ parameters:
count: 2
path: src/Plugins/Auth/AuthenticationSignon.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Plugins/Auth/AuthenticationSignon.php
-
message: '#^Parameter \#1 \$id of function session_id expects string\|null, mixed given\.$#'
identifier: argument.type
@ -10098,12 +9900,6 @@ parameters:
count: 2
path: src/Plugins/Export/ExportMediawiki.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Plugins/Export/ExportMediawiki.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
@ -10218,12 +10014,6 @@ parameters:
count: 5
path: src/Plugins/Export/ExportOdt.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Plugins/Export/ExportOdt.php
-
message: '#^Only booleans are allowed in an if condition, array\|false given\.$#'
identifier: if.condNotBoolean
@ -10245,7 +10035,7 @@ parameters:
-
message: '#^Parameter \#1 \$string of function htmlspecialchars expects string, string\|null given\.$#'
identifier: argument.type
count: 7
count: 8
path: src/Plugins/Export/ExportOdt.php
-
@ -10590,7 +10380,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 3
count: 2
path: src/Plugins/Export/ExportTexytext.php
-
@ -10890,7 +10680,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 4
count: 3
path: src/Plugins/Export/Helpers/Pdf.php
-
@ -10899,6 +10689,12 @@ parameters:
count: 6
path: src/Plugins/Export/Helpers/Pdf.php
-
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
identifier: if.condNotBoolean
count: 1
path: src/Plugins/Export/Helpers/Pdf.php
-
message: '#^Only numeric types are allowed in \-, \(array\|float\|int\) given on the left side\.$#'
identifier: minus.leftNonNumeric
@ -11145,13 +10941,13 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 4
count: 3
path: src/Plugins/Import/ImportCsv.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 19
count: 17
path: src/Plugins/Import/ImportCsv.php
-
@ -11232,18 +11028,6 @@ parameters:
count: 1
path: src/Plugins/Import/ImportOds.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Plugins/Import/ImportOds.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Plugins/Import/ImportOds.php
-
message: '#^Offset ''name'' might not exist on SimpleXMLElement\|null\.$#'
identifier: offsetAccess.notFound
@ -11313,12 +11097,6 @@ parameters:
count: 1
path: src/Plugins/Import/ImportShp.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Plugins/Import/ImportShp.php
-
message: '#^Offset ''dirname'' might not exist on array\{dirname\?\: string, basename\: string, extension\?\: string, filename\: string\}\.$#'
identifier: offsetAccess.notFound
@ -11781,7 +11559,7 @@ parameters:
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 5
count: 2
path: src/Plugins/Schema/Pdf/Pdf.php
-
@ -11889,16 +11667,10 @@ parameters:
count: 1
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
count: 1
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
-
@ -12111,12 +11883,6 @@ parameters:
count: 7
path: src/Plugins/Schema/Svg/RelationStatsSvg.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 2
path: src/Plugins/Schema/Svg/Svg.php
-
message: '#^Parameter \#4 \$masterField of method PhpMyAdmin\\Plugins\\Schema\\Svg\\SvgRelationSchema\:\:addRelation\(\) expects string, \(int\|string\) given\.$#'
identifier: argument.type
@ -12189,12 +11955,6 @@ parameters:
count: 1
path: src/Plugins/Transformations/Abs/DateFormatTransformationsPlugin.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Plugins/Transformations/Abs/DateFormatTransformationsPlugin.php
-
message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, mixed given\.$#'
identifier: argument.type
@ -12327,12 +12087,6 @@ parameters:
count: 2
path: src/Plugins/Transformations/Abs/SubstringTransformationsPlugin.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Plugins/Transformations/Abs/SubstringTransformationsPlugin.php
-
message: '#^Binary operation "\." between mixed and string results in an error\.$#'
identifier: binaryOp.invalid
@ -12375,12 +12129,6 @@ parameters:
count: 2
path: src/Plugins/Transformations/Abs/TextLinkTransformationsPlugin.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
path: src/Plugins/Transformations/Input/Text_Plain_Iptobinary.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@ -12642,12 +12390,6 @@ parameters:
count: 2
path: src/Replication/Replication.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Replication/Replication.php
-
message: '#^Method PhpMyAdmin\\Replication\\Replication\:\:replicaBinLogPrimary\(\) should return array\{File\?\: string, Position\?\: string\} but returns array\{\}\|array\{File\: string\|null, Position\: string\|null\}\.$#'
identifier: return.type
@ -12862,14 +12604,14 @@ parameters:
path: src/Routing/Routing.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
count: 1
path: src/Routing/Routing.php
-
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
message: '#^Only booleans are allowed in an if condition, int\<0, max\>\|false given\.$#'
identifier: if.condNotBoolean
count: 1
path: src/Routing/Routing.php
@ -13137,7 +12879,7 @@ parameters:
-
message: '#^Cannot cast mixed to int\.$#'
identifier: cast.int
count: 4
count: 6
path: src/Server/Privileges.php
-
@ -13167,7 +12909,7 @@ parameters:
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 6
count: 4
path: src/Server/Privileges.php
-
@ -13665,12 +13407,6 @@ parameters:
count: 3
path: src/Server/Status/Processes.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Server/Status/Processes.php
-
message: '#^Method PhpMyAdmin\\Server\\Status\\Processes\:\:getList\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
@ -13815,24 +13551,18 @@ parameters:
count: 4
path: src/Setup/Index.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Setup/Index.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Setup/Index.php
-
message: '#^Only booleans are allowed in a negated boolean, mixed given\.$#'
identifier: booleanNot.exprNotBoolean
count: 1
path: src/Setup/Index.php
-
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
identifier: if.condNotBoolean
count: 1
path: src/Setup/Index.php
-
message: '#^PHPDoc tag @var with type PhpMyAdmin\\Config\\Forms\\BaseForm is not subtype of native type string\|null\.$#'
identifier: varTag.nativeType
@ -13935,30 +13665,18 @@ parameters:
count: 1
path: src/Sql.php
-
message: '#^Cannot cast mixed to int\.$#'
identifier: cast.int
count: 1
path: src/Sql.php
-
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
identifier: empty.notAllowed
count: 10
path: src/Sql.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 7
path: src/Sql.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 6
path: src/Sql.php
-
message: '#^Method PhpMyAdmin\\Sql\:\:calculatePosForLastPage\(\) should return int but returns mixed\.$#'
identifier: return.type
count: 1
path: src/Sql.php
-
message: '#^Method PhpMyAdmin\\Sql\:\:countQueryResults\(\) should return int\|numeric\-string but returns float\|int\|numeric\-string\.$#'
identifier: return.type
@ -13983,6 +13701,12 @@ parameters:
count: 1
path: src/Sql.php
-
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
count: 3
path: src/Sql.php
-
message: '#^Only booleans are allowed in &&, string given on the left side\.$#'
identifier: booleanAnd.leftNotBoolean
@ -14007,6 +13731,12 @@ parameters:
count: 1
path: src/Sql.php
-
message: '#^Only booleans are allowed in a negated boolean, mixed given\.$#'
identifier: booleanNot.exprNotBoolean
count: 1
path: src/Sql.php
-
message: '#^Only booleans are allowed in an if condition, PhpMyAdmin\\Dbal\\ResultInterface\|false given\.$#'
identifier: if.condNotBoolean
@ -14370,12 +14100,6 @@ parameters:
count: 2
path: src/Table/Search.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/Table/Search.php
-
message: '#^Parameter \#1 \$gisString of static method PhpMyAdmin\\Utils\\Gis\:\:createData\(\) expects string, mixed given\.$#'
identifier: argument.type
@ -14523,13 +14247,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 12
path: src/Table/Table.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 2
count: 3
path: src/Table/Table.php
-
@ -14790,18 +14508,6 @@ parameters:
count: 1
path: src/Tracking/Tracker.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Tracking/Tracker.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 7
path: src/Tracking/Tracker.php
-
message: '#^Method PhpMyAdmin\\Tracking\\Tracker\:\:isTracked\(\) should return bool but returns mixed\.$#'
identifier: return.type
@ -14920,8 +14626,8 @@ parameters:
path: src/Tracking/Tracking.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
identifier: booleanAnd.rightNotBoolean
count: 13
path: src/Tracking/Tracking.php
@ -14967,18 +14673,6 @@ parameters:
count: 1
path: src/Tracking/Tracking.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: src/Transformations.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 4
path: src/Transformations.php
-
message: '#^Method PhpMyAdmin\\Transformations\:\:getClassName\(\) should return class\-string\<PhpMyAdmin\\Plugins\\TransformationsInterface\> but returns string\.$#'
identifier: return.type
@ -15084,13 +14778,7 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 3
path: src/UniqueCondition.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
count: 2
path: src/UniqueCondition.php
-
@ -15234,12 +14922,6 @@ parameters:
count: 1
path: src/UserPreferences.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 1
path: src/UserPrivilegesFactory.php
-
message: '#^Only booleans are allowed in a negated boolean, PhpMyAdmin\\Dbal\\ResultInterface\|false given\.$#'
identifier: booleanNot.exprNotBoolean
@ -15381,13 +15063,13 @@ parameters:
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 3
count: 2
path: src/Util.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed
count: 6
count: 3
path: src/Util.php
-

View File

@ -480,6 +480,9 @@
<DeprecatedMethod>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<RiskyTruthyFalsyComparison>
<code><![CDATA[$_REQUEST['printview']]]></code>
</RiskyTruthyFalsyComparison>
</file>
<file src="src/Config/ServerConfigChecks.php">
<MixedAssignment>
@ -613,6 +616,9 @@
<DeprecatedMethod>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<DocblockTypeContradiction>
<code><![CDATA[$foreign[$field] !== '']]></code>
</DocblockTypeContradiction>
<InvalidReturnStatement>
<code><![CDATA[$tableNameReplacements]]></code>
</InvalidReturnStatement>
@ -660,6 +666,9 @@
<PossiblyUnusedReturnValue>
<code><![CDATA[bool]]></code>
</PossiblyUnusedReturnValue>
<RedundantConditionGivenDocblockType>
<code><![CDATA[isset($foreign[$field]) && $foreign[$field] !== '']]></code>
</RedundantConditionGivenDocblockType>
<RiskyTruthyFalsyComparison>
<code><![CDATA[$relationParams[$work]]]></code>
<code><![CDATA[empty($this->config->selectedServer[$feature])]]></code>
@ -2933,6 +2942,7 @@
<code><![CDATA[$_POST['maxPlotLimit']]]></code>
</RiskyCast>
<RiskyTruthyFalsyComparison>
<code><![CDATA[$_POST['get_data_row']]]></code>
<code><![CDATA[empty($_POST['maxPlotLimit'])]]></code>
<code><![CDATA[empty($row->collation)]]></code>
</RiskyTruthyFalsyComparison>
@ -5887,9 +5897,6 @@
<code><![CDATA[Config::getInstance()]]></code>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<DocblockTypeContradiction>
<code><![CDATA[$resp == null]]></code>
</DocblockTypeContradiction>
<MixedArgument>
<code><![CDATA[$serverCookie]]></code>
<code><![CDATA[$serverCookie]]></code>
@ -7905,6 +7912,9 @@
<DeprecatedMethod>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<RiskyTruthyFalsyComparison>
<code><![CDATA[$questionPos]]></code>
</RiskyTruthyFalsyComparison>
</file>
<file src="src/Sanitize.php">
<DeprecatedMethod>
@ -8124,10 +8134,12 @@
<code><![CDATA[$row1[0]]]></code>
</PossiblyUndefinedArrayOffset>
<RiskyCast>
<code><![CDATA[$_POST['grant_count']]]></code>
<code><![CDATA[$_POST['max_connections']]]></code>
<code><![CDATA[$_POST['max_questions']]]></code>
<code><![CDATA[$_POST['max_updates']]]></code>
<code><![CDATA[$_POST['max_user_connections']]]></code>
<code><![CDATA[$_REQUEST['column_count']]]></code>
</RiskyCast>
<RiskyTruthyFalsyComparison>
<code><![CDATA[empty($_POST[$currentGrant[0] . '_none'])]]></code>
@ -8402,7 +8414,6 @@
</MixedArrayAssignment>
<MixedAssignment>
<code><![CDATA[$maxRows]]></code>
<code><![CDATA[$pos]]></code>
<code><![CDATA[$sortCol]]></code>
<code><![CDATA[$unlimNumRows]]></code>
</MixedAssignment>
@ -8417,8 +8428,6 @@
<code><![CDATA[$statementInfo->statement->where[0]->expr]]></code>
</MixedPropertyFetch>
<MixedReturnStatement>
<code><![CDATA[$pos]]></code>
<code><![CDATA[$pos]]></code>
<code><![CDATA[$unlimNumRows]]></code>
<code><![CDATA[$unlimNumRows]]></code>
<code><![CDATA[@((int) ceil($numberOfLine / $maxRows) - 1) * $maxRows]]></code>
@ -8465,6 +8474,9 @@
</RedundantCondition>
<RiskyTruthyFalsyComparison>
<code><![CDATA[! $index->isUnique()]]></code>
<code><![CDATA[$_POST['grid_edit']]]></code>
<code><![CDATA[$_POST['printview']]]></code>
<code><![CDATA[$_POST['printview']]]></code>
<code><![CDATA[$table]]></code>
<code><![CDATA[empty($_GET['id_bookmark'])]]></code>
<code><![CDATA[empty($_GET['id_bookmark'])]]></code>
@ -8910,9 +8922,6 @@
<code><![CDATA[$tokens[0]]]></code>
<code><![CDATA[$tokens[2]]]></code>
</PossiblyNullArrayAccess>
<PossiblyNullOperand>
<code><![CDATA[$statement]]></code>
</PossiblyNullOperand>
<PossiblyNullPropertyFetch>
<code><![CDATA[$parser->list->tokens]]></code>
<code><![CDATA[$statement->fields[0]->table]]></code>
@ -8988,6 +8997,21 @@
<code><![CDATA[$tableName]]></code>
<code><![CDATA[$versionNumber]]></code>
</PossiblyNullArgument>
<RiskyTruthyFalsyComparison>
<code><![CDATA[$_POST['alter_table']]]></code>
<code><![CDATA[$_POST['alter_view']]]></code>
<code><![CDATA[$_POST['create_index']]]></code>
<code><![CDATA[$_POST['create_table']]]></code>
<code><![CDATA[$_POST['create_view']]]></code>
<code><![CDATA[$_POST['delete']]]></code>
<code><![CDATA[$_POST['drop_index']]]></code>
<code><![CDATA[$_POST['drop_table']]]></code>
<code><![CDATA[$_POST['drop_view']]]></code>
<code><![CDATA[$_POST['insert']]]></code>
<code><![CDATA[$_POST['rename_table']]]></code>
<code><![CDATA[$_POST['truncate']]]></code>
<code><![CDATA[$_POST['update']]]></code>
</RiskyTruthyFalsyComparison>
</file>
<file src="src/Transformations.php">
<LessSpecificReturnStatement>

View File

@ -396,8 +396,7 @@ class Advisor
}
$num = round($num, $precision);
if ($num == 0) {
if ($num === 0.0) {
$num = '<' . 10 ** (-$precision);
}

View File

@ -285,7 +285,7 @@ class Config
(! isset($configData['ThemeDefault'])
&& $themeManager->theme->getId() !== 'original')
|| isset($configData['ThemeDefault'])
&& $configData['ThemeDefault'] != $themeManager->theme->getId()
&& $configData['ThemeDefault'] !== $themeManager->theme->getId()
) {
$this->setUserValue(
null,
@ -295,7 +295,7 @@ class Config
);
}
} elseif (
$this->settings['ThemeDefault'] != $themeManager->theme->getId()
$this->settings['ThemeDefault'] !== $themeManager->theme->getId()
&& $themeManager->themeExists($this->settings['ThemeDefault'])
) {
// no cookie - read default from settings
@ -536,7 +536,7 @@ class Config
} elseif (Util::getProtoFromForwardedHeader(Core::getEnv('HTTP_FORWARDED')) === 'https') {
// RFC 7239 Forwarded header
$isHttps = true;
} elseif (Core::getEnv('SERVER_PORT') == 443) {
} elseif ((int) Core::getEnv('SERVER_PORT') === 443) {
$isHttps = true;
}

View File

@ -430,7 +430,7 @@ class ConfigFile
unset($_SESSION[$this->id]['Servers'][$lastServer]);
if (! isset($_SESSION[$this->id]['ServerDefault']) || $_SESSION[$this->id]['ServerDefault'] != $lastServer) {
if (! isset($_SESSION[$this->id]['ServerDefault']) || $_SESSION[$this->id]['ServerDefault'] !== $lastServer) {
return;
}

View File

@ -55,7 +55,7 @@ class PageSettings
return;
}
if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
if (isset($_REQUEST['printview']) && $_REQUEST['printview']) {
return;
}
@ -72,7 +72,7 @@ class PageSettings
// Process form
$error = null;
if (isset($_POST['submit_save']) && $_POST['submit_save'] == $formGroupName) {
if (isset($_POST['submit_save']) && $_POST['submit_save'] === $formGroupName) {
$error = $this->processPageSettings($formDisplay, $configFile);
}

View File

@ -351,7 +351,7 @@ class ServerConfigChecks
// $cfg['LoginCookieStore']
// LoginCookieValidity must be less or equal to LoginCookieStore
if (
$this->cfg->getValue('LoginCookieStore') == 0
$this->cfg->getValue('LoginCookieStore') === 0
|| $loginCookieValidity <= $this->cfg->getValue('LoginCookieStore')
) {
return;

View File

@ -160,43 +160,43 @@ class Relation
}
foreach ($tables as $table) {
if ($table == $this->config->selectedServer['bookmarktable']) {
if ($table === $this->config->selectedServer['bookmarktable']) {
$relationParams['bookmark'] = $table;
} elseif ($table == $this->config->selectedServer['relation']) {
} elseif ($table === $this->config->selectedServer['relation']) {
$relationParams['relation'] = $table;
} elseif ($table == $this->config->selectedServer['table_info']) {
} elseif ($table === $this->config->selectedServer['table_info']) {
$relationParams['table_info'] = $table;
} elseif ($table == $this->config->selectedServer['table_coords']) {
} elseif ($table === $this->config->selectedServer['table_coords']) {
$relationParams['table_coords'] = $table;
} elseif ($table == $this->config->selectedServer['column_info']) {
} elseif ($table === $this->config->selectedServer['column_info']) {
$relationParams['column_info'] = $table;
} elseif ($table == $this->config->selectedServer['pdf_pages']) {
} elseif ($table === $this->config->selectedServer['pdf_pages']) {
$relationParams['pdf_pages'] = $table;
} elseif ($table == $this->config->selectedServer['history']) {
} elseif ($table === $this->config->selectedServer['history']) {
$relationParams['history'] = $table;
} elseif ($table == $this->config->selectedServer['recent']) {
} elseif ($table === $this->config->selectedServer['recent']) {
$relationParams['recent'] = $table;
} elseif ($table == $this->config->selectedServer['favorite']) {
} elseif ($table === $this->config->selectedServer['favorite']) {
$relationParams['favorite'] = $table;
} elseif ($table == $this->config->selectedServer['table_uiprefs']) {
} elseif ($table === $this->config->selectedServer['table_uiprefs']) {
$relationParams['table_uiprefs'] = $table;
} elseif ($table == $this->config->selectedServer['tracking']) {
} elseif ($table === $this->config->selectedServer['tracking']) {
$relationParams['tracking'] = $table;
} elseif ($table == $this->config->selectedServer['userconfig']) {
} elseif ($table === $this->config->selectedServer['userconfig']) {
$relationParams['userconfig'] = $table;
} elseif ($table == $this->config->selectedServer['users']) {
} elseif ($table === $this->config->selectedServer['users']) {
$relationParams['users'] = $table;
} elseif ($table == $this->config->selectedServer['usergroups']) {
} elseif ($table === $this->config->selectedServer['usergroups']) {
$relationParams['usergroups'] = $table;
} elseif ($table == $this->config->selectedServer['navigationhiding']) {
} elseif ($table === $this->config->selectedServer['navigationhiding']) {
$relationParams['navigationhiding'] = $table;
} elseif ($table == $this->config->selectedServer['savedsearches']) {
} elseif ($table === $this->config->selectedServer['savedsearches']) {
$relationParams['savedsearches'] = $table;
} elseif ($table == $this->config->selectedServer['central_columns']) {
} elseif ($table === $this->config->selectedServer['central_columns']) {
$relationParams['central_columns'] = $table;
} elseif ($table == $this->config->selectedServer['designer_settings']) {
} elseif ($table === $this->config->selectedServer['designer_settings']) {
$relationParams['designer_settings'] = $table;
} elseif ($table == $this->config->selectedServer['export_templates']) {
} elseif ($table === $this->config->selectedServer['export_templates']) {
$relationParams['export_templates'] = $table;
}
}
@ -421,7 +421,7 @@ class Relation
foreach ($internalRelations[$table] as $field => $relations) {
if (
($column !== '' && $column !== $field)
|| (isset($foreign[$field]) && $foreign[$field] != '')
|| (isset($foreign[$field]) && $foreign[$field] !== '')
) {
continue;
}
@ -750,7 +750,7 @@ class Relation
// beginning of dropdown
$ret = '<option value="">&nbsp;</option>';
$topCount = count($top);
if ($max == -1 || $topCount < $max) {
if ($max === -1 || $topCount < $max) {
$ret .= implode('', $top);
if ($foreignDisplay && $topCount > 0) {
// this empty option is to visually mark the beginning of the
@ -796,7 +796,7 @@ class Relation
}
$foreigner = $this->searchColumnInForeigners($foreigners, $field);
if ($foreigner == false) {
if ($foreigner === false || $foreigner === []) {
break;
}

View File

@ -189,7 +189,7 @@ final class DesignerController implements InvocableController
}
$selectedPage = null;
if ($displayPage != -1) {
if ($displayPage !== -1) {
$selectedPage = $this->designerCommon->getPageName($displayPage);
}

View File

@ -80,7 +80,7 @@ final readonly class FavoriteTableController implements InvocableController
} elseif (isset($_REQUEST['add_favorite'])) {
if (! $alreadyFavorite) {
$numTables = count($favoriteInstance->getTables());
if ($numTables == $this->config->settings['NumFavoriteTables']) {
if ($numTables === $this->config->settings['NumFavoriteTables']) {
$changes = false;
} else {
// Otherwise add to favorite list.

View File

@ -596,7 +596,7 @@ final class StructureController implements InvocableController
$do = (is_string($searchDoDBInTruename) && $searchDoDBInTruename !== '')
|| (is_string($searchDoDBInDB) && $searchDoDBInDB !== '')
|| ($nbServReplicaDoDb == 0 && $nbServReplicaIgnoreDb == 0)
|| ($nbServReplicaDoDb === 0 && $nbServReplicaIgnoreDb === 0)
|| $this->hasTable($replicaInfo['Wild_Do_Table'], $table);
$searchDb = array_search(Current::$database, $replicaInfo['Ignore_DB']);

View File

@ -102,7 +102,7 @@ final class HomeController implements InvocableController
$hasServer = Current::$server > 0 || count($this->config->settings['Servers']) > 1;
if ($hasServer) {
$hasServerSelection = $this->config->settings['ServerDefault'] == 0
$hasServerSelection = $this->config->settings['ServerDefault'] === 0
|| (
$this->config->settings['NavigationDisplayServers']
&& (
@ -188,14 +188,14 @@ final class HomeController implements InvocableController
$relationParameters = $relation->getRelationParameters();
if (
! $relationParameters->hasAllFeatures()
&& $this->config->settings['PmaNoRelation_DisableWarning'] == false
&& ! $this->config->settings['PmaNoRelation_DisableWarning']
) {
$messageText = __(
'The phpMyAdmin configuration storage is not completely '
. 'configured, some extended features have been deactivated. '
. '%sFind out why%s. ',
);
if ($this->config->settings['ZeroConf'] == true) {
if ($this->config->settings['ZeroConf']) {
$messageText .= '<br>'
. __('Or alternately go to \'Operations\' tab of any database to set it up there.');
}
@ -253,7 +253,7 @@ final class HomeController implements InvocableController
{
$this->checkPhpExtensionsRequirements();
if ($this->config->settings['LoginCookieValidityDisableWarning'] == false) {
if (! $this->config->settings['LoginCookieValidityDisableWarning']) {
/**
* Check whether session.gc_maxlifetime limits session validity.
*/
@ -276,7 +276,7 @@ final class HomeController implements InvocableController
* Check whether LoginCookieValidity is limited by LoginCookieStore.
*/
if (
$this->config->settings['LoginCookieStore'] != 0
$this->config->settings['LoginCookieStore'] !== 0
&& $this->config->settings['LoginCookieStore'] < $this->config->settings['LoginCookieValidity']
) {
$this->errors[] = [
@ -361,7 +361,7 @@ final class HomeController implements InvocableController
* Warning about Suhosin only if its simulation mode is not enabled
*/
if (
$this->config->settings['SuhosinDisableWarning'] == false
! $this->config->settings['SuhosinDisableWarning']
&& ini_get('suhosin.request.max_value_length')
&& ini_get('suhosin.simulation') == '0'
) {

View File

@ -560,7 +560,7 @@ final readonly class ImportController implements InvocableController
Current::$message->addParamHtml('<a href="' . $importUrl . '">');
Current::$message->addParamHtml('</a>');
if (ImportSettings::$offset === 0 || (isset($originalSkip) && $originalSkip == ImportSettings::$offset)) {
if (ImportSettings::$offset === 0 || (isset($originalSkip) && $originalSkip === ImportSettings::$offset)) {
Current::$message->addText(
__(
'However on last run no data has been parsed,'

View File

@ -270,7 +270,7 @@ final readonly class DatabaseController implements InvocableController
$collations = Charsets::getCollations($this->dbi, $this->config->selectedServer['DisableIS']);
if (
! $relationParameters->hasAllFeatures() && $this->config->settings['PmaNoRelation_DisableWarning'] == false
! $relationParameters->hasAllFeatures() && ! $this->config->settings['PmaNoRelation_DisableWarning']
) {
Current::$message = Message::notice(
__(

View File

@ -143,7 +143,7 @@ final class FindReplaceController implements InvocableController
$type = $row->type;
// reformat mysql query output
if (strncasecmp($type, 'set', 3) == 0 || strncasecmp($type, 'enum', 4) == 0) {
if (strncasecmp($type, 'set', 3) === 0 || strncasecmp($type, 'enum', 4) === 0) {
$type = str_replace(',', ', ', $type);
} else {
// strip the "BINARY" attribute, except if we find "BINARY(" because

View File

@ -414,7 +414,7 @@ final class ReplaceController implements InvocableController
}
}
if ($request->getParsedBodyParam('do_transformations') == true) {
if ($request->getParsedBodyParam('do_transformations')) {
$editedValues = [];
parse_str($request->getParsedBodyParamAsString('transform_fields_list'), $editedValues);

View File

@ -121,7 +121,7 @@ final class SearchController implements InvocableController
}
// reformat mysql query output
if (strncasecmp($type, 'set', 3) == 0 || strncasecmp($type, 'enum', 4) == 0) {
if (strncasecmp($type, 'set', 3) === 0 || strncasecmp($type, 'enum', 4) === 0) {
$type = str_replace(',', ', ', $type);
} else {
// strip the "BINARY" attribute, except if we find "BINARY(" because

View File

@ -138,7 +138,7 @@ final class ZoomSearchController implements InvocableController
/**
* Handle AJAX request for data row on point select
*/
if (isset($_POST['get_data_row']) && $_POST['get_data_row'] == true) {
if (isset($_POST['get_data_row']) && $_POST['get_data_row']) {
$this->getDataRowAction();
return $this->response->response();
@ -210,7 +210,7 @@ final class ZoomSearchController implements InvocableController
}
// reformat mysql query output
if (strncasecmp($type, 'set', 3) == 0 || strncasecmp($type, 'enum', 4) == 0) {
if (strncasecmp($type, 'set', 3) === 0 || strncasecmp($type, 'enum', 4) === 0) {
$type = str_replace(',', ', ', $type);
} else {
// strip the "BINARY" attribute, except if we find "BINARY(" because

View File

@ -39,7 +39,7 @@ final class VersionCheckController implements InvocableController
$latestCompatible = $this->versionInformation->getLatestCompatibleVersion($versionDetails);
$version = '';
$date = '';
if ($latestCompatible != null) {
if ($latestCompatible !== null) {
$version = $latestCompatible->version;
$date = $latestCompatible->date;
}

View File

@ -614,7 +614,7 @@ class CentralColumns
private function getHtmlForEditTableRow(array $row, int $rowNum): string
{
$meta = [];
if (! isset($row['col_default']) || $row['col_default'] == '') {
if (! isset($row['col_default']) || $row['col_default'] === '') {
$meta['DefaultType'] = 'NONE';
} elseif ($row['col_default'] === 'CURRENT_TIMESTAMP' || $row['col_default'] === 'current_timestamp()') {
$meta['DefaultType'] = 'CURRENT_TIMESTAMP';
@ -819,7 +819,7 @@ class CentralColumns
$rowNum = 0;
foreach ($rowsList as $row) {
$rowsMeta[$rowNum] = [];
if (! isset($row['col_default']) || $row['col_default'] == '') {
if (! isset($row['col_default']) || $row['col_default'] === '') {
$rowsMeta[$rowNum]['DefaultType'] = 'NONE';
} elseif ($row['col_default'] === 'CURRENT_TIMESTAMP' || $row['col_default'] === 'current_timestamp()') {
$rowsMeta[$rowNum]['DefaultType'] = 'CURRENT_TIMESTAMP';

View File

@ -352,7 +352,7 @@ class Common
}
$defaultPageNo = $this->getDefaultPage($db);
if ($defaultPageNo != -1) {
if ($defaultPageNo !== -1) {
return $defaultPageNo;
}

View File

@ -193,7 +193,7 @@ class Search
foreach ($allColumns as $column) {
if (
$this->criteriaColumnName !== ''
&& $column->field != $this->criteriaColumnName
&& $column->field !== $this->criteriaColumnName
) {
continue;
}

View File

@ -1000,8 +1000,8 @@ class DatabaseInterface
string $value,
ConnectionType $connectionType = ConnectionType::User,
): void {
$currentValue = $this->getVariable($var, self::GETVAR_SESSION, $connectionType);
if ($currentValue == $value) {
$currentValue = (string) $this->getVariable($var, self::GETVAR_SESSION, $connectionType);
if ($currentValue === $value) {
return;
}

View File

@ -449,8 +449,8 @@ class Results
// Displays edit/delete/sort/insert links?
if (
$isLink
&& $previousTable != ''
&& $field->table != ''
&& $previousTable !== ''
&& $field->table !== ''
&& $field->table !== $previousTable
) {
// don't display links
@ -461,14 +461,14 @@ class Results
// Always display print view link
$hasPrintLink = true;
if ($field->table == '') {
if ($field->table === '') {
continue;
}
$previousTable = $field->table;
}
if ($previousTable == '') { // no table for any of the columns
if ($previousTable === '') { // no table for any of the columns
// don't display links
$hasEditLink = false;
$deleteLink = DeleteLinkEnum::NO_DELETE;
@ -1072,7 +1072,7 @@ class Results
{
if (
isset($_SESSION['tmpval']['possible_as_geometry'])
&& $_SESSION['tmpval']['possible_as_geometry'] == false
&& ! $_SESSION['tmpval']['possible_as_geometry']
&& $_SESSION['tmpval']['geoOption'] === self::GEOMETRY_DISP_GEOM
) {
$_SESSION['tmpval']['geoOption'] = self::GEOMETRY_DISP_WKT;
@ -1742,11 +1742,11 @@ class Results
}
$trClass = [];
if ($this->config->settings['BrowsePointerEnable'] != true) {
if (! $this->config->settings['BrowsePointerEnable']) {
$trClass[] = 'nopointer';
}
if ($this->config->settings['BrowseMarkerEnable'] != true) {
if (! $this->config->settings['BrowseMarkerEnable']) {
$trClass[] = 'nomarker';
}
@ -2033,7 +2033,7 @@ class Results
: '';
$gridEdit = '';
if ($meta->orgtable != '' && $gridEditConfig !== 'disabled') {
if ($meta->orgtable !== '' && $gridEditConfig !== 'disabled') {
$gridEdit = $gridEditConfig === 'click' ? 'grid_edit click1' : 'grid_edit click2';
}
@ -3304,7 +3304,7 @@ class Results
$message->addText('(');
if ($messageViewWarning === false) {
if ($this->unlimNumRows != $total) {
if ($this->unlimNumRows !== $total) {
$messageTotal = Message::notice(
$preCount . __('%1$s total, %2$s in query'),
);

View File

@ -118,7 +118,7 @@ class Encoding
self::initEngine();
}
return self::$engine != self::ENGINE_NONE;
return self::$engine !== self::ENGINE_NONE;
}
/**
@ -300,7 +300,7 @@ class Encoding
/* Most engines do not support listing */
$config = Config::getInstance();
if (self::$engine != self::ENGINE_MBSTRING) {
if (self::$engine !== self::ENGINE_MBSTRING) {
return array_filter($config->settings['AvailableCharsets'], static function (string $charset): bool {
// Removes any ignored character
$normalizedCharset = strtoupper((string) preg_replace(['/[^A-Za-z0-9\-\/]/'], '', $charset));

View File

@ -116,7 +116,7 @@ class ErrorReport
$errors = [];
// create php error report
$i = 0;
if (! isset($_SESSION['prev_errors']) || $_SESSION['prev_errors'] == '') {
if (! isset($_SESSION['prev_errors']) || $_SESSION['prev_errors'] === '') {
return [];
}

View File

@ -184,7 +184,7 @@ class Export
$writeResult = @fwrite(self::$fileHandle, $this->dumpBuffer);
// Here, use strlen rather than mb_strlen to get the length
// in bytes to compare against the number of bytes written.
if ($writeResult != strlen($this->dumpBuffer)) {
if ($writeResult === false || $writeResult !== strlen($this->dumpBuffer)) {
Current::$message = Message::error(
__('Insufficient space to save the file %s.'),
);

View File

@ -223,7 +223,7 @@ final class FieldMetadata
$type === MYSQLI_TYPE_LONG_BLOB ||
$type === MYSQLI_TYPE_VAR_STRING ||
$type === MYSQLI_TYPE_STRING
) && $this->charsetnr == 63;
) && $this->charsetnr === 63;
}
/**

View File

@ -609,7 +609,7 @@ class File
return feof($this->handle);
}
return $this->offset == strlen($this->content ?? '');
return $this->offset === strlen($this->content ?? '');
}
/**

View File

@ -219,7 +219,7 @@ class Git
$firstbyte = intval(substr($hash, 0, 2), 16);
// array is indexed from 1 and we need to get
// previous entry for start
$start = $firstbyte == 0 ? 0 : $fanout[$firstbyte];
$start = $firstbyte === 0 ? 0 : $fanout[$firstbyte];
$end = $fanout[$firstbyte + 1];
@ -487,7 +487,7 @@ class Git
// parse line
$parts = explode(' ', $line);
// care only about named refs
if (count($parts) != 2) {
if (count($parts) !== 2) {
continue;
}

View File

@ -418,7 +418,7 @@ class Generator
}
$config = Config::getInstance();
$renderSql = $config->settings['ShowSQL'] == true && $sqlQuery !== '' && $sqlQuery !== ';';
$renderSql = $config->settings['ShowSQL'] && $sqlQuery !== '' && $sqlQuery !== ';';
if (isset(Sql::$usingBookmarkMessage)) {
$retval .= Sql::$usingBookmarkMessage->getDisplay();

View File

@ -744,7 +744,7 @@ class Import
ImportSettings::$importNotice = '';
/* Run the $additional_sql statements supplied by the caller plug-in */
if ($additionalSql != null) {
if ($additionalSql !== null) {
/* Clean the SQL first */
/**
@ -1056,7 +1056,7 @@ class Import
$result = $dbi->tryQuery($checkQuery);
return $result && $result->numRows() == 1;
return $result && $result->numRows() === 1;
}
/** @return string[] */

View File

@ -328,7 +328,7 @@ class Menu
$tabs['search']['icon'] = 'b_search';
$tabs['search']['route'] = '/database/search';
$tabs['search']['active'] = $route === '/database/search';
if ($numTables == 0) {
if ($numTables === 0) {
$tabs['search']['warning'] = __('Database seems to be empty!');
}
@ -336,7 +336,7 @@ class Menu
$tabs['query']['icon'] = 's_db';
$tabs['query']['route'] = '/database/multi-table-query';
$tabs['query']['active'] = $route === '/database/multi-table-query';
if ($numTables == 0) {
if ($numTables === 0) {
$tabs['query']['warning'] = __('Database seems to be empty!');
}
@ -344,7 +344,7 @@ class Menu
$tabs['export']['icon'] = 'b_export';
$tabs['export']['route'] = '/database/export';
$tabs['export']['active'] = $route === '/database/export';
if ($numTables == 0) {
if ($numTables === 0) {
$tabs['export']['warning'] = __('Database seems to be empty!');
}

View File

@ -383,7 +383,7 @@ class NavigationTree
array_shift($path); // remove db
if (($path === [] || ! array_key_exists($path[0], $containers)) && count($containers) != 1) {
if (($path === [] || ! array_key_exists($path[0], $containers)) && count($containers) !== 1) {
return $db;
}

View File

@ -687,7 +687,7 @@ class Node
}
$prefixMap[$prefix] = 1;
if (count($prefixMap) == $total) {
if (count($prefixMap) === $total) {
break;
}
}
@ -779,7 +779,7 @@ class Node
}
$prefixMap[$prefix] = 1;
if (count($prefixMap) == $total) {
if (count($prefixMap) === $total) {
break 2;
}
}

View File

@ -989,8 +989,8 @@ class Normalization
. 'COUNT(DISTINCT ' . $partialKey . ',' . $column . ') as pkColCnt '
. 'FROM (SELECT * FROM ' . Util::backquote($table)
. ' LIMIT 500) as dt;';
$pkColCnt = $this->dbi->fetchValue($query);
if ($pkCnt !== 0 && $pkCnt === $colCnt && $colCnt == $pkColCnt) {
$pkColCnt = (int) $this->dbi->fetchValue($query);
if ($pkCnt !== 0 && $pkCnt === $colCnt && $colCnt === $pkColCnt) {
return true;
}

View File

@ -502,7 +502,7 @@ class Operations
* This patch is to support newer MySQL/MariaDB while also for backward compatibilities.
*/
if (
(strtolower($innodbFileFormat) === 'barracuda') || ($innodbFileFormat == '')
strtolower($innodbFileFormat) === 'barracuda' || $innodbFileFormat === ''
&& $innodbEnginePlugin->supportsFilePerTable()
) {
$possibleRowFormats['INNODB']['DYNAMIC'] = 'DYNAMIC';
@ -568,7 +568,7 @@ class Operations
. '.'
. Util::backquote($arr['foreign_table']);
if ($arr['foreign_table'] == Current::$table) {
if ($arr['foreign_table'] === Current::$table) {
$foreignTable = Current::$table . '1';
$joinQuery .= ' AS ' . Util::backquote($foreignTable);
} else {
@ -657,7 +657,7 @@ class Operations
if (
$pmaTable->isEngine(['MYISAM', 'ARIA', 'ISAM'])
&& isset($_POST['new_pack_keys'])
&& $_POST['new_pack_keys'] != $packKeys
&& $_POST['new_pack_keys'] !== $packKeys
) {
$tableAlters[] = 'pack_keys = ' . $_POST['new_pack_keys'];
}
@ -884,7 +884,7 @@ class Operations
* A target table name has been sent to this script -> do the work
*/
if (isset($_POST['new_name']) && is_scalar($_POST['new_name']) && (string) $_POST['new_name'] !== '') {
if ($db === $targetDb && $table == $_POST['new_name']) {
if ($db === $targetDb && $table === $_POST['new_name']) {
if (isset($_POST['submit_move'])) {
$message = Message::error(__('Can\'t move table to same one!'));
} else {

View File

@ -285,7 +285,7 @@ class Plugins
$text = $propertyGroup->getText();
}
if ($text != null) {
if ($text !== null && $text !== '') {
$ret .= '<h5 class="card-title mt-4 mb-2">' . $plugin->getTranslatedText($text) . '</h5>';
}

View File

@ -92,7 +92,7 @@ class AuthenticationConfig extends AuthenticationPlugin
$errorHandler->addNotice($failure->getMessage());
} else {
// Check whether user has configured something
if ($config->sourceMtime == 0) {
if ($config->sourceMtime === 0) {
echo '<p>' , sprintf(
__(
'You probably did not create a configuration file.'

View File

@ -122,7 +122,7 @@ class AuthenticationCookie extends AuthenticationPlugin
// Show error message
if (self::$connectionError !== '') {
$errorMessages = Message::rawError(self::$connectionError)->getDisplay();
} elseif (isset($_GET['session_expired']) && (int) $_GET['session_expired'] == 1) {
} elseif (isset($_GET['session_expired']) && (int) $_GET['session_expired'] === 1) {
$errorMessages = Message::rawError(
__('Your session has expired. Please log in again.'),
)->getDisplay();
@ -264,7 +264,7 @@ class AuthenticationCookie extends AuthenticationPlugin
);
// Check if the captcha entered is valid, if not stop the login.
if ($resp == null || ! $resp->isSuccess()) {
if (! $resp->isSuccess()) {
$codes = $resp->getErrorCodes();
if (in_array('invalid-json', $codes)) {

View File

@ -103,7 +103,7 @@ class AuthenticationSignon extends AuthenticationPlugin
$config = Config::getInstance();
/* Check if we're using same signon server */
$signonUrl = $config->selectedServer['SignonURL'];
if (isset($_SESSION['LAST_SIGNON_URL']) && $_SESSION['LAST_SIGNON_URL'] != $signonUrl) {
if (isset($_SESSION['LAST_SIGNON_URL']) && $_SESSION['LAST_SIGNON_URL'] !== $signonUrl) {
return false;
}

View File

@ -242,7 +242,7 @@ class ExportMediawiki extends ExportPlugin
// Print data comment
$output = $this->exportComment(
$tableAlias != ''
$tableAlias !== ''
? 'Table data for ' . Util::backquote($tableAlias)
: 'Query results',
);

View File

@ -240,7 +240,7 @@ class ExportOdt extends ExportPlugin
$this->buffer .= '<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">';
$tableAlias != ''
$tableAlias !== ''
? $this->buffer .= __('Dumping data for table') . ' ' . htmlspecialchars($tableAlias)
: $this->buffer .= __('Dumping data for query result');
$this->buffer .= '</text:h>'

View File

@ -173,7 +173,7 @@ class ExportTexytext extends ExportPlugin
if (
! $this->export->outputHandler(
$tableAlias != ''
$tableAlias !== ''
? '== ' . __('Dumping data for table') . ' ' . $tableAlias . "\n\n"
: '==' . __('Dumping data for query result') . "\n\n",
)

View File

@ -783,7 +783,7 @@ class Pdf extends PdfLib
$this->tablewidths[$i] = $sColWidth + $surplusToAdd;
}
if ($this->displayColumn[$i] != false) {
if ($this->displayColumn[$i]) {
continue;
}

View File

@ -544,13 +544,13 @@ class ImportCsv extends AbstractImportCsv
$i = 0;
$lasti = -1;
$ch = mb_substr($buffer, 0, 1);
if ($this->maxLines > 0 && $line == $maxLinesConstraint) {
if ($this->maxLines > 0 && $line === $maxLinesConstraint) {
ImportSettings::$finished = true;
break;
}
}
if ($this->maxLines > 0 && $line == $maxLinesConstraint) {
if ($this->maxLines > 0 && $line === $maxLinesConstraint) {
ImportSettings::$finished = true;
break;
}
@ -664,7 +664,7 @@ class ImportCsv extends AbstractImportCsv
Current::$message->addParam(__('Columns escaped with'));
Import::$hasError = true;
$paramError = true;
} elseif (mb_strlen($csvNewLine) != 1 && $csvNewLine !== 'auto') {
} elseif (mb_strlen($csvNewLine) !== 1 && $csvNewLine !== 'auto') {
Current::$message = Message::error(
__('Invalid parameter for CSV import: %s'),
);

View File

@ -243,7 +243,7 @@ class ImportOds extends ImportPlugin
$text = $cell->children('text', true);
$cellAttrs = $cell->attributes('office', true);
if ($text->count() != 0) {
if ($text->count() !== 0) {
$attr = $cell->attributes('table', true);
$numRepeat = (int) $attr['number-columns-repeated'];
$numIterations = $numRepeat !== 0 ? $numRepeat : 1;
@ -256,7 +256,7 @@ class ImportOds extends ImportPlugin
}
// skip empty repeats in the last row
if ($a == $cellCount) {
if ($a === $cellCount) {
continue;
}

View File

@ -222,7 +222,7 @@ class ImportShp extends ImportPlugin
$colNames = [];
foreach ($shp->records as $record) {
$tempRow = [];
if ($gisObj == null || ! method_exists($gisObj, 'getShape')) {
if ($gisObj === null || ! method_exists($gisObj, 'getShape')) {
$tempRow[] = null;
} else {
$tempRow[] = "GeomFromText('" . $gisObj->getShape($record->shpData) . "')";

View File

@ -355,7 +355,7 @@ class Pdf extends PdfLib
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r", '', $txt);
$nb = strlen($s);
if ($nb > 0 && $s[$nb - 1] == "\n") {
if ($nb > 0 && $s[$nb - 1] === "\n") {
$nb--;
}
@ -366,7 +366,7 @@ class Pdf extends PdfLib
$nl = 1;
while ($i < $nb) {
$c = $s[$i];
if ($c == "\n") {
if ($c === "\n") {
$i++;
$sep = -1;
$j = $i;
@ -381,7 +381,7 @@ class Pdf extends PdfLib
$l += $cw[mb_ord($c)] ?? 0;
if ($l > $wmax) {
if ($sep == -1) {
if ($sep === -1) {
if ($i === $j) {
$i++;
}

View File

@ -592,7 +592,7 @@ class PdfRelationSchema extends ExportRelationSchema
$break = true;
}
if ($break == true) {
if ($break) {
$this->pdf->Cell(0, 3, '', 0, 1);
$this->pdf->Ln();
}
@ -650,7 +650,7 @@ class PdfRelationSchema extends ExportRelationSchema
$linksTo = '';
if ($foreigner) {
$linksTo = '-> ';
if ($foreigner['foreign_db'] != $this->db->getName()) {
if ($foreigner['foreign_db'] !== $this->db->getName()) {
$linksTo .= $foreigner['foreign_db'] . '.';
}

View File

@ -129,7 +129,7 @@ class Svg extends XMLWriter
$width = (int) $width;
$height = (int) $height;
if ($x != 0 || $y != 0) {
if ((float) $x !== 0.0 || (float) $y !== 0.0) {
$this->writeAttribute('viewBox', sprintf('%d %d %d %d', $x, $y, $width, $height));
}

View File

@ -77,7 +77,7 @@ abstract class DateFormatTransformationsPlugin extends TransformationsPlugin
// (Note: prior to MySQL 4.1, TIMESTAMP has a display size
// for example TIMESTAMP(8) means YYYYMMDD)
} elseif (preg_match('/^(\d{2}){3,7}$/', $buffer) === 1) {
if (mb_strlen($buffer) == 14 || mb_strlen($buffer) == 8) {
if (mb_strlen($buffer) === 14 || mb_strlen($buffer) === 8) {
$offset = 4;
} else {
$offset = 2;

View File

@ -65,7 +65,7 @@ abstract class SubstringTransformationsPlugin extends TransformationsPlugin
$newtext = $options[2] . $newtext;
}
if ($length + $optionZero != $baselength) {
if ($length + $optionZero !== $baselength) {
$newtext .= $options[2];
}
}

View File

@ -68,7 +68,7 @@ class Text_Plain_Iptobinary extends IOTransformationsPlugin
$val = '';
if ($value !== '') {
$length = strlen($value);
if ($length == 4 || $length == 16) {
if ($length === 4 || $length === 16) {
$ip = @inet_ntop(pack('A' . $length, $value));
if ($ip !== false) {
$val = $ip;

View File

@ -65,7 +65,7 @@ class Replication
return -1;
}
if ($control !== 'SQL_THREAD' && $control !== 'IO_THREAD' && $control != null) {
if ($control !== 'SQL_THREAD' && $control !== 'IO_THREAD' && $control !== '') {
return -1;
}

View File

@ -223,7 +223,7 @@ class Routing
$pathInfo = Core::getEnv('PATH_INFO');
if ($pathInfo !== '' && $pmaPhpSelf !== '') {
$questionPos = mb_strpos($pmaPhpSelf, '?');
if ($questionPos != false) {
if ($questionPos) {
$pmaPhpSelf = mb_substr($pmaPhpSelf, 0, $questionPos);
}

View File

@ -237,7 +237,7 @@ class Privileges
($grantValue === 'Y')
|| ($row === null
&& is_array($grantValue)
&& count($grantValue) == $_REQUEST['column_count']
&& count($grantValue) === (int) $_REQUEST['column_count']
&& empty($_POST[$currentGrant[0] . '_none']))
) {
if ($enableHTML) {
@ -275,7 +275,7 @@ class Privileges
} else {
$privs[] = 'USAGE';
}
} elseif ($allPrivileges && (! isset($_POST['grant_count']) || count($privs) == $_POST['grant_count'])) {
} elseif ($allPrivileges && (! isset($_POST['grant_count']) || count($privs) === (int) $_POST['grant_count'])) {
if ($enableHTML) {
$privs = ['<dfn title="' . __('Includes all privileges except GRANT.') . '">ALL PRIVILEGES</dfn>'];
} else {

View File

@ -108,7 +108,7 @@ final class Processes
foreach ($sortableColumns as $columnKey => $column) {
$isSorted = $orderByField !== ''
&& $sortOrder !== ''
&& $orderByField == $column['order_by_field'];
&& $orderByField === $column['order_by_field'];
$column['sort_order'] = 'ASC';
if ($isSorted && $sortOrder === 'ASC') {

View File

@ -69,7 +69,7 @@ class Index
foreach ($_SESSION['messages'] as &$messages) {
$removeIds = [];
foreach ($messages as $id => $msg) {
if ($msg['active'] != false) {
if ($msg['active']) {
continue;
}
@ -132,7 +132,7 @@ class Index
}
$latestCompatible = $versionInformation->getLatestCompatibleVersion($versionData);
if ($latestCompatible == null) {
if ($latestCompatible === null) {
return;
}

View File

@ -40,6 +40,7 @@ use function count;
use function defined;
use function htmlspecialchars;
use function in_array;
use function is_string;
use function session_start;
use function session_write_close;
use function sprintf;
@ -153,18 +154,18 @@ class Sql
$justOneTable = true;
$prevTable = '';
foreach ($fieldsMeta as $oneFieldMeta) {
if ($oneFieldMeta->table != '' && $prevTable != '' && $oneFieldMeta->table != $prevTable) {
if ($oneFieldMeta->table !== '' && $prevTable !== '' && $oneFieldMeta->table !== $prevTable) {
$justOneTable = false;
}
if ($oneFieldMeta->table == '') {
if ($oneFieldMeta->table === '') {
continue;
}
$prevTable = $oneFieldMeta->table;
}
return $justOneTable && $prevTable != '';
return $justOneTable && $prevTable !== '';
}
/**
@ -576,10 +577,10 @@ class Sql
return false;
}
/** Is false, except when a USE statement was sent. */
$currentDb = $this->dbi->fetchValue('SELECT DATABASE()');
// $current_db is false, except when a USE statement was sent
return ($currentDb != false) && ($db !== $currentDb);
return is_string($currentDb) && $db !== $currentDb;
}
/**
@ -1082,7 +1083,7 @@ class Sql
StatementInfo $statementInfo,
bool $isLimitedDisplay = false,
): string {
$printView = isset($_POST['printview']) && $_POST['printview'] == '1';
$printView = isset($_POST['printview']) && $_POST['printview'];
$isBrowseDistinct = ! empty($_POST['is_browse_distinct']);
if ($statementInfo->flags->isProcedure) {
@ -1273,7 +1274,7 @@ class Sql
): string {
// If we are retrieving the full value of a truncated field or the original
// value of a transformed field, show it here
if (isset($_POST['grid_edit']) && $_POST['grid_edit'] == true) {
if (isset($_POST['grid_edit']) && $_POST['grid_edit']) {
$this->getResponseForGridEdit($result);
ResponseRenderer::getInstance()->callExit();
}
@ -1343,7 +1344,7 @@ class Sql
]);
}
if (isset($_POST['printview']) && $_POST['printview'] == '1') {
if (isset($_POST['printview']) && $_POST['printview']) {
$displayParts = DisplayParts::fromArray([
'hasEditLink' => false,
'deleteLink' => DeleteLinkEnum::NO_DELETE,
@ -1355,7 +1356,7 @@ class Sql
]);
}
if (! isset($_POST['printview']) || $_POST['printview'] != '1') {
if (! isset($_POST['printview']) || ! $_POST['printview']) {
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
Current::$message = null;
@ -1561,7 +1562,7 @@ class Sql
$warningMessages = $this->dbi->getWarnings();
// No rows returned -> move back to the calling page
if (($numRows == 0 && $unlimNumRows == 0) || $statementInfo->flags->isAffected || $result === false) {
if (($numRows === 0 && $unlimNumRows === 0) || $statementInfo->flags->isAffected || $result === false) {
$htmlOutput = $this->getQueryResponseForNoResultsReturned(
$statementInfo,
$db,
@ -1631,13 +1632,13 @@ class Sql
public function calculatePosForLastPage(string $db, string $table, int|null $pos): int
{
if ($pos === null) {
$pos = $_SESSION['tmpval']['pos'];
$pos = (int) $_SESSION['tmpval']['pos'];
}
$tableObject = new Table($table, $db, $this->dbi);
$unlimNumRows = $tableObject->countRecords(true);
//If position is higher than number of rows
if ($unlimNumRows <= $pos && $pos != 0) {
if ($unlimNumRows <= $pos && $pos !== 0) {
return $this->getStartPosToDisplayRow($unlimNumRows);
}

View File

@ -150,7 +150,7 @@ final class Search
$where = '';
if ($unaryFlag) {
$where = $backquotedName . ' ' . $funcType;
} elseif (strncasecmp($types, 'enum', 4) == 0 && ! empty($criteriaValues)) {
} elseif (strncasecmp($types, 'enum', 4) === 0 && ! empty($criteriaValues)) {
$where = $backquotedName;
$where .= $this->getEnumWhereClause($criteriaValues, $funcType);
} elseif ($criteriaValues != '') {

View File

@ -660,7 +660,7 @@ class Table implements Stringable
$rowCount = $this->dbi->fetchValue(
'SELECT COUNT(*) FROM ' . Util::backquote($this->dbName) . '.' . Util::backquote($this->name),
);
} elseif ($config->settings['MaxExactCountViews'] == 0) {
} elseif ($config->settings['MaxExactCountViews'] === 0) {
// For complex views, even trying to get a partial record
// count could bring down a server, so we offer an
// alternative: setting MaxExactCountViews to 0 will bypass
@ -1208,7 +1208,7 @@ class Table implements Stringable
}
// check if the table has not been modified
if ($this->getStatusInfo('Create_time') == $this->uiprefs['CREATE_TIME']) {
if ($this->getStatusInfo('Create_time') === $this->uiprefs['CREATE_TIME']) {
return array_map(intval(...), $this->uiprefs[$property->value]);
}
@ -1241,7 +1241,7 @@ class Table implements Stringable
&& ($property === UiProperty::ColumnOrder || $property === UiProperty::ColumnVisibility)
) {
$currCreateTime = $this->getStatusInfo('CREATE_TIME');
if ($tableCreateTime === null || $tableCreateTime != $currCreateTime) {
if ($tableCreateTime === null || $tableCreateTime !== $currCreateTime) {
// there is no $table_create_time, or
// supplied $table_create_time is older than current create time,
// so don't save
@ -1396,9 +1396,9 @@ class Table implements Stringable
. $this->dbi->quoteString($foreignTable, ConnectionType::ControlUser) . ','
. $this->dbi->quoteString($foreignField, ConnectionType::ControlUser) . ')';
} elseif (
$existrel[$masterField]['foreign_db'] != $foreignDb
|| $existrel[$masterField]['foreign_table'] != $foreignTable
|| $existrel[$masterField]['foreign_field'] != $foreignField
$existrel[$masterField]['foreign_db'] !== $foreignDb
|| $existrel[$masterField]['foreign_table'] !== $foreignTable
|| $existrel[$masterField]['foreign_field'] !== $foreignField
) {
$updQuery = 'UPDATE '
. Util::backquote($relationFeature->database)
@ -1507,11 +1507,11 @@ class Table implements Stringable
if (
$refDbName != $foreignDb
|| $existrelForeign[$masterFieldMd5]->refTableName != $foreignTable
|| $existrelForeign[$masterFieldMd5]->refIndexList != $foreignField
|| $existrelForeign[$masterFieldMd5]->indexList != $masterField
|| $existrelForeign[$masterFieldMd5]->refIndexList !== $foreignField
|| $existrelForeign[$masterFieldMd5]->indexList !== $masterField
|| $_POST['constraint_name'][$masterFieldMd5] != $constraintName
|| ($_POST['on_delete'][$masterFieldMd5] != $onDelete)
|| ($_POST['on_update'][$masterFieldMd5] != $onUpdate)
|| ($_POST['on_delete'][$masterFieldMd5] !== $onDelete)
|| ($_POST['on_update'][$masterFieldMd5] !== $onUpdate)
) {
// another foreign key is already defined for this field
// or an option has been changed for ON DELETE or ON UPDATE
@ -1716,7 +1716,7 @@ class Table implements Stringable
$fields = TableUtils::getFields($stmt);
}
if ($column != null) {
if ($column !== null && $column !== '') {
$expression = isset($fields[$column]['expr']) ? substr($fields[$column]['expr'], 1, -1) : '';
return [$column => $expression];

View File

@ -121,7 +121,7 @@ class Tracker
$dbi->quoteString($tableName, ConnectionType::ControlUser),
);
$result = $dbi->fetchValue($sqlQuery, 0, ConnectionType::ControlUser) == 1;
$result = (int) $dbi->fetchValue($sqlQuery, 0, ConnectionType::ControlUser) === 1;
self::$trackingCache[$dbName][$tableName] = $result;
@ -199,12 +199,12 @@ class Tracker
// Get DROP TABLE / DROP VIEW and CREATE TABLE SQL statements
$createSql = '';
if ($config->selectedServer['tracking_add_drop_table'] == true && ! $isView) {
if ($config->selectedServer['tracking_add_drop_table'] && ! $isView) {
$createSql .= self::getLogComment()
. 'DROP TABLE IF EXISTS ' . Util::backquote($tableName) . ";\n";
}
if ($config->selectedServer['tracking_add_drop_view'] == true && $isView) {
if ($config->selectedServer['tracking_add_drop_view'] && $isView) {
$createSql .= self::getLogComment()
. 'DROP VIEW IF EXISTS ' . Util::backquote($tableName) . ";\n";
}
@ -267,7 +267,7 @@ class Tracker
$createSql = '';
if ($config->selectedServer['tracking_add_drop_database'] == true) {
if ($config->selectedServer['tracking_add_drop_database']) {
$createSql .= self::getLogComment() . 'DROP DATABASE IF EXISTS ' . Util::backquote($dbName) . ";\n";
}
@ -387,7 +387,7 @@ class Tracker
$dbi->quoteString($tablename, ConnectionType::ControlUser),
);
if ($statement != '') {
if ($statement !== null && $statement !== '') {
$sqlQuery .= " AND FIND_IN_SET('" . $statement . "',tracking) > 0";
}
@ -592,7 +592,7 @@ class Tracker
$version = self::getVersion($dbname, $result['tablename'], $result['identifier']);
// If version not exists and auto-creation is enabled
if (Config::getInstance()->selectedServer['tracking_version_auto_create'] == true && $version == -1) {
if (Config::getInstance()->selectedServer['tracking_version_auto_create'] && $version === -1) {
// Create the version
switch ($result['identifier']) {
@ -609,7 +609,7 @@ class Tracker
}
// If version exists
if ($version == -1) {
if ($version === -1) {
return;
}

View File

@ -887,55 +887,55 @@ class Tracking
// a key is absent from the request if it has been removed from
// tracking_default_statements in the config
if (isset($_POST['alter_table']) && $_POST['alter_table'] == true) {
if (isset($_POST['alter_table']) && $_POST['alter_table']) {
$trackingSet .= 'ALTER TABLE,';
}
if (isset($_POST['rename_table']) && $_POST['rename_table'] == true) {
if (isset($_POST['rename_table']) && $_POST['rename_table']) {
$trackingSet .= 'RENAME TABLE,';
}
if (isset($_POST['create_table']) && $_POST['create_table'] == true) {
if (isset($_POST['create_table']) && $_POST['create_table']) {
$trackingSet .= 'CREATE TABLE,';
}
if (isset($_POST['drop_table']) && $_POST['drop_table'] == true) {
if (isset($_POST['drop_table']) && $_POST['drop_table']) {
$trackingSet .= 'DROP TABLE,';
}
if (isset($_POST['alter_view']) && $_POST['alter_view'] == true) {
if (isset($_POST['alter_view']) && $_POST['alter_view']) {
$trackingSet .= 'ALTER VIEW,';
}
if (isset($_POST['create_view']) && $_POST['create_view'] == true) {
if (isset($_POST['create_view']) && $_POST['create_view']) {
$trackingSet .= 'CREATE VIEW,';
}
if (isset($_POST['drop_view']) && $_POST['drop_view'] == true) {
if (isset($_POST['drop_view']) && $_POST['drop_view']) {
$trackingSet .= 'DROP VIEW,';
}
if (isset($_POST['create_index']) && $_POST['create_index'] == true) {
if (isset($_POST['create_index']) && $_POST['create_index']) {
$trackingSet .= 'CREATE INDEX,';
}
if (isset($_POST['drop_index']) && $_POST['drop_index'] == true) {
if (isset($_POST['drop_index']) && $_POST['drop_index']) {
$trackingSet .= 'DROP INDEX,';
}
if (isset($_POST['insert']) && $_POST['insert'] == true) {
if (isset($_POST['insert']) && $_POST['insert']) {
$trackingSet .= 'INSERT,';
}
if (isset($_POST['update']) && $_POST['update'] == true) {
if (isset($_POST['update']) && $_POST['update']) {
$trackingSet .= 'UPDATE,';
}
if (isset($_POST['delete']) && $_POST['delete'] == true) {
if (isset($_POST['delete']) && $_POST['delete']) {
$trackingSet .= 'DELETE,';
}
if (isset($_POST['truncate']) && $_POST['truncate'] == true) {
if (isset($_POST['truncate']) && $_POST['truncate']) {
$trackingSet .= 'TRUNCATE,';
}

View File

@ -86,10 +86,10 @@ class Transformations
while (($option = array_shift($transformOptions)) !== null) {
$trimmed = trim($option);
if (strlen($trimmed) > 1 && $trimmed[0] == "'" && $trimmed[strlen($trimmed) - 1] == "'") {
if (strlen($trimmed) > 1 && $trimmed[0] === "'" && $trimmed[strlen($trimmed) - 1] === "'") {
// '...'
$option = mb_substr($trimmed, 1, -1);
} elseif (isset($trimmed[0]) && $trimmed[0] == "'") {
} elseif (isset($trimmed[0]) && $trimmed[0] === "'") {
// '...,
$trimmed = ltrim($option);
$rtrimmed = '';
@ -98,7 +98,7 @@ class Transformations
// ...,
$trimmed .= ',' . $option;
$rtrimmed = rtrim($trimmed);
if ($rtrimmed[strlen($rtrimmed) - 1] == "'") {
if ($rtrimmed[strlen($rtrimmed) - 1] === "'") {
// ,...'
break;
}
@ -403,7 +403,7 @@ class Transformations
if ($testRs->numRows() > 0) {
$row = $testRs->fetchAssoc();
if (! $forcedelete && ($hasValue || $row['comment'] != '')) {
if (! $forcedelete && ($hasValue || $row['comment'] !== null && $row['comment'] !== '')) {
$updQuery = 'UPDATE '
. Util::backquote($browserTransformationFeature->database) . '.'
. Util::backquote($browserTransformationFeature->columnInfo)

View File

@ -62,7 +62,7 @@ class UniqueCondition
continue;
}
if (strcasecmp($meta->name, $expression->alias) == 0) {
if (strcasecmp($meta->name, $expression->alias) === 0) {
$meta->orgname = $expression->column;
break;
}
@ -87,7 +87,7 @@ class UniqueCondition
// If this field is not from the table which the unique clause needs
// to be restricted to.
if ($restrictToTable !== '' && $restrictToTable != $meta->table) {
if ($restrictToTable !== '' && $restrictToTable !== $meta->table) {
continue;
}

View File

@ -179,7 +179,7 @@ class UserPrivilegesFactory
$dbNameToTest,
),
)
|| mb_substr($this->dbi->getError(), 1, 4) == 1044)
|| (int) mb_substr($this->dbi->getError(), 1, 4) === 1044)
) {
continue;
}

View File

@ -765,7 +765,7 @@ class Util
}
foreach ($pages as $i) {
if ($i == $pageNow) {
if ($i === $pageNow) {
$selected = 'selected style="font-weight: bold"';
} else {
$selected = '';
@ -842,7 +842,7 @@ class Util
public static function printableBitValue(int $value, int $length): string
{
// if running on a 64-bit server or the length is safe for decbin()
if (PHP_INT_SIZE == 8 || $length < 33) {
if (PHP_INT_SIZE === 8 || $length < 33) {
$printable = decbin($value);
} else {
// FIXME: does not work for the leftmost bit of a 64-bit value
@ -1818,7 +1818,7 @@ class Util
$orderLinkParams = [];
$orderLinkParams['title'] = __('Sort');
// If this column was requested to be sorted.
if ($requestedSort == $sort) {
if ($requestedSort === $sort) {
if ($requestedSortOrder === 'ASC') {
$futureSortOrder = 'DESC';
// current sort order is ASC
@ -1917,7 +1917,10 @@ class Util
public static function getTableListPosition(ServerRequest $request, string $db): int
{
if (! isset($_SESSION['tmpval']['table_limit_offset']) || $_SESSION['tmpval']['table_limit_offset_db'] != $db) {
if (
! isset($_SESSION['tmpval']['table_limit_offset'])
|| $_SESSION['tmpval']['table_limit_offset_db'] !== $db
) {
$_SESSION['tmpval']['table_limit_offset'] = 0;
$_SESSION['tmpval']['table_limit_offset_db'] = $db;
}