From 4fb335e96051fba6aef643a23f942f5fcdb6bf0a Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 5 Dec 2023 00:01:54 +0100 Subject: [PATCH] Make in_array strict Signed-off-by: Kamil Tekiela --- phpstan-baseline.neon | 301 ++---------------- psalm-baseline.xml | 22 -- src/ConfigStorage/Relation.php | 2 +- .../Database/DesignerController.php | 2 +- .../Database/RoutinesController.php | 7 +- .../Database/StructureController.php | 4 +- src/Controllers/ErrorReportController.php | 2 +- src/Controllers/Export/ExportController.php | 2 +- src/Controllers/Import/ImportController.php | 2 +- .../Server/DatabasesController.php | 2 +- .../Server/Status/VariablesController.php | 4 +- src/Controllers/Setup/AbstractController.php | 2 +- src/Controllers/Table/ReplaceController.php | 3 +- src/Controllers/Table/SearchController.php | 6 +- .../Table/ZoomSearchController.php | 6 +- src/Controllers/Triggers/IndexController.php | 5 +- src/Controllers/View/CreateController.php | 6 +- src/Core.php | 2 +- src/CreateAddField.php | 2 +- src/Database/CentralColumns.php | 10 +- src/Database/Designer/Common.php | 2 +- src/Database/Events.php | 4 +- src/Database/Routines.php | 10 +- src/Display/Results.php | 3 + src/Error.php | 4 +- src/Export/Export.php | 2 +- src/Git.php | 4 +- src/Html/Generator.php | 2 +- src/InsertEdit.php | 14 +- src/Language.php | 2 +- src/Menu.php | 14 +- src/Navigation/NavigationTree.php | 24 +- src/Navigation/Nodes/Node.php | 4 +- src/Navigation/Nodes/NodeDatabase.php | 2 +- src/Normalization.php | 16 +- src/Plugins/Auth/AuthenticationSignon.php | 2 +- src/Plugins/Export/ExportHtmlword.php | 2 +- src/Plugins/Export/ExportLatex.php | 2 +- src/Plugins/Export/ExportTexytext.php | 2 +- src/Plugins/Schema/Dia/DiaRelationSchema.php | 4 +- src/Plugins/Schema/Eps/EpsRelationSchema.php | 4 +- src/Plugins/Schema/Pdf/PdfRelationSchema.php | 4 +- src/Plugins/Schema/Svg/SvgRelationSchema.php | 4 +- src/Query/Compatibility.php | 2 +- src/Replication/ReplicationGui.php | 2 +- src/Server/Privileges.php | 32 +- src/Table/ColumnsDefinition.php | 2 +- src/Table/Search.php | 2 +- src/Table/Table.php | 4 +- src/Triggers/Triggers.php | 9 +- src/TwoFactor.php | 8 +- src/Types.php | 2 +- src/Util.php | 10 +- tests/classes/AbstractTestCase.php | 4 +- tests/classes/TwoFactorTest.php | 6 +- 55 files changed, 169 insertions(+), 437 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 8db91dc54b..f94fe5992b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1115,11 +1115,6 @@ parameters: count: 1 path: src/ConfigStorage/Relation.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - message: "#^Cannot access an offset on mixed\\.$#" count: 1 @@ -1680,11 +1675,6 @@ parameters: count: 1 path: src/Controllers/Database/DataDictionaryController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Database/DesignerController.php - - message: "#^Cannot access offset 'dbName' on mixed\\.$#" count: 2 @@ -2060,11 +2050,6 @@ parameters: count: 1 path: src/Controllers/Database/MultiTableQueryController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Controllers/Database/RoutinesController.php - - message: "#^Cannot access an offset on mixed\\.$#" count: 6 @@ -2187,7 +2172,7 @@ parameters: - message: "#^Parameter \\#3 \\$which of static method PhpMyAdmin\\\\Database\\\\Routines\\:\\:getDetails\\(\\) expects string\\|null, mixed given\\.$#" - count: 2 + count: 1 path: src/Controllers/Database/RoutinesController.php - @@ -2705,11 +2690,6 @@ parameters: count: 4 path: src/Controllers/Database/StructureController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Controllers/Database/StructureController.php - - message: "#^Cannot access offset 'Check_time' on mixed\\.$#" count: 1 @@ -3035,11 +3015,6 @@ parameters: count: 1 path: src/Controllers/Database/TrackingController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/ErrorReportController.php - - message: "#^Cannot access offset 'success' on mixed\\.$#" count: 1 @@ -3065,11 +3040,6 @@ parameters: count: 1 path: src/Controllers/Export/ExportController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Export/ExportController.php - - message: "#^Cannot access offset 'aliases' on mixed\\.$#" count: 1 @@ -3440,11 +3410,6 @@ parameters: count: 1 path: src/Controllers/Import/ImportController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Import/ImportController.php - - message: "#^Cannot access offset 'error' on mixed\\.$#" count: 1 @@ -3552,7 +3517,7 @@ parameters: - message: "#^Parameter \\#1 \\$path of static method PhpMyAdmin\\\\Core\\:\\:securePath\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Controllers/Import/ImportController.php - @@ -4580,11 +4545,6 @@ parameters: count: 4 path: src/Controllers/Server/DatabasesController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Server/DatabasesController.php - - message: "#^Cannot access offset 'DEFAULT_COLLATION…' on mixed\\.$#" count: 1 @@ -5055,11 +5015,6 @@ parameters: count: 1 path: src/Controllers/Server/Status/VariablesController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Server/Status/VariablesController.php - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" count: 1 @@ -5145,11 +5100,6 @@ parameters: count: 1 path: src/Controllers/Server/Variables/SetVariableController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Setup/AbstractController.php - - message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#" count: 1 @@ -6585,11 +6535,6 @@ parameters: count: 2 path: src/Controllers/Table/ReplaceController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Table/ReplaceController.php - - message: "#^Call to function method_exists\\(\\) with PhpMyAdmin\\\\Plugins\\\\IOTransformationsPlugin and 'isSuccess' will always evaluate to true\\.$#" count: 1 @@ -6865,11 +6810,6 @@ parameters: count: 1 path: src/Controllers/Table/ReplaceController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Controllers/Table/SearchController.php - - message: "#^Cannot access offset int on mixed\\.$#" count: 1 @@ -7855,11 +7795,6 @@ parameters: count: 2 path: src/Controllers/Table/ZoomSearchController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Controllers/Table/ZoomSearchController.php - - message: "#^Cannot access offset 0 on mixed\\.$#" count: 3 @@ -8040,11 +7975,6 @@ parameters: count: 1 path: src/Controllers/Transformation/WrapperController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Controllers/Triggers/IndexController.php - - message: "#^Cannot call method isSuccess\\(\\) on mixed\\.$#" count: 1 @@ -8215,11 +8145,6 @@ parameters: count: 1 path: src/Controllers/VersionCheckController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Controllers/View/CreateController.php - - message: "#^Cannot access offset 'back' on mixed\\.$#" count: 1 @@ -8322,7 +8247,7 @@ parameters: - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 4 + count: 3 path: src/Core.php - @@ -8395,11 +8320,6 @@ parameters: count: 3 path: src/CreateAddField.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/CreateAddField.php - - message: "#^Cannot access offset 'col_index' on mixed\\.$#" count: 1 @@ -8552,7 +8472,7 @@ parameters: - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 9 + count: 4 path: src/Database/CentralColumns.php - @@ -8835,11 +8755,6 @@ parameters: count: 3 path: src/Database/Designer/Common.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Database/Designer/Common.php - - message: "#^Cannot access offset 'ENGINE' on mixed\\.$#" count: 5 @@ -9000,11 +8915,6 @@ parameters: count: 1 path: src/Database/Events.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Database/Events.php - - message: "#^Cannot access an offset on mixed\\.$#" count: 6 @@ -9090,11 +9000,6 @@ parameters: count: 3 path: src/Database/Routines.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 5 - path: src/Database/Routines.php - - message: "#^Cannot access an offset on mixed\\.$#" count: 9 @@ -9207,7 +9112,7 @@ parameters: - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" - count: 23 + count: 22 path: src/Database/Routines.php - @@ -9355,11 +9260,6 @@ parameters: count: 3 path: src/Database/Routines.php - - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: src/Database/Routines.php - - message: "#^Parameter \\#7 \\$itemType of method PhpMyAdmin\\\\Database\\\\Routines\\:\\:processParamsAndBuild\\(\\) expects string, mixed given\\.$#" count: 1 @@ -9645,11 +9545,6 @@ parameters: count: 6 path: src/Display/Results.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Display/Results.php - - message: "#^Cannot access offset 'display_binary' on mixed\\.$#" count: 8 @@ -10095,11 +9990,6 @@ parameters: count: 3 path: src/Error.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Error.php - - message: "#^Cannot access offset 'args' on mixed\\.$#" count: 1 @@ -10267,7 +10157,7 @@ parameters: - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 + count: 1 path: src/Export/Export.php - @@ -10915,11 +10805,6 @@ parameters: count: 1 path: src/Gis/GisVisualization.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Git.php - - message: "#^Cannot access offset 1 on array\\|false\\.$#" count: 2 @@ -11087,7 +10972,7 @@ parameters: - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 + count: 1 path: src/Html/Generator.php - @@ -11700,11 +11585,6 @@ parameters: count: 2 path: src/InsertEdit.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 7 - path: src/InsertEdit.php - - message: "#^Cannot access offset 'relational_display' on mixed\\.$#" count: 1 @@ -12015,11 +11895,6 @@ parameters: count: 1 path: src/IpAllowDeny.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Language.php - - message: "#^Cannot access offset 'a_meta_dir' on mixed\\.$#" count: 1 @@ -12150,11 +12025,6 @@ parameters: count: 1 path: src/Menu.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 5 - path: src/Menu.php - - message: "#^Cannot access offset 'icon' on mixed\\.$#" count: 22 @@ -12250,11 +12120,6 @@ parameters: count: 1 path: src/Navigation/NavigationTree.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 12 - path: src/Navigation/NavigationTree.php - - message: "#^Cannot access offset 'image' on mixed\\.$#" count: 1 @@ -12435,11 +12300,6 @@ parameters: count: 1 path: src/Navigation/Nodes/Node.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Navigation/Nodes/Node.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 5 @@ -12505,11 +12365,6 @@ parameters: count: 1 path: src/Navigation/Nodes/NodeColumn.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Navigation/Nodes/NodeDatabase.php - - message: "#^Method PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeDatabase\\:\\:getEventCount\\(\\) should return int but returns int\\|string\\.$#" count: 1 @@ -12557,7 +12412,7 @@ parameters: - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 7 + count: 1 path: src/Normalization.php - @@ -13345,11 +13200,6 @@ parameters: count: 1 path: src/Plugins/Auth/AuthenticationHttp.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Plugins/Auth/AuthenticationSignon.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 @@ -13490,11 +13340,6 @@ parameters: count: 3 path: src/Plugins/Export/ExportCsv.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Plugins/Export/ExportHtmlword.php - - message: "#^Cannot access offset 'columns' on mixed\\.$#" count: 3 @@ -13545,11 +13390,6 @@ parameters: count: 1 path: src/Plugins/Export/ExportJson.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Plugins/Export/ExportLatex.php - - message: "#^Cannot access offset 'columns' on mixed\\.$#" count: 2 @@ -14140,11 +13980,6 @@ parameters: count: 1 path: src/Plugins/Export/ExportSql.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Plugins/Export/ExportTexytext.php - - message: "#^Cannot access offset 'columns' on mixed\\.$#" count: 3 @@ -15165,11 +15000,6 @@ parameters: count: 2 path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" count: 1 @@ -15177,7 +15007,7 @@ parameters: - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Dia/DiaRelationSchema.php - @@ -15192,7 +15022,7 @@ parameters: - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Dia/DiaRelationSchema.php - @@ -15215,11 +15045,6 @@ parameters: count: 1 path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - message: "#^Parameter \\#3 \\$foreignTable of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Dia\\\\DiaRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - message: "#^Parameter \\#4 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Dia\\\\DiaRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" count: 2 @@ -15250,11 +15075,6 @@ parameters: count: 2 path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" count: 1 @@ -15262,7 +15082,7 @@ parameters: - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Eps/EpsRelationSchema.php - @@ -15277,7 +15097,7 @@ parameters: - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Eps/EpsRelationSchema.php - @@ -15300,11 +15120,6 @@ parameters: count: 1 path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - message: "#^Parameter \\#5 \\$foreignTable of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Eps\\\\EpsRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - message: "#^Parameter \\#6 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Eps\\\\EpsRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" count: 2 @@ -15385,11 +15200,6 @@ parameters: count: 2 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - message: "#^Call to method TCPDF\\:\\:Line\\(\\) with incorrect case\\: line$#" count: 2 @@ -15427,7 +15237,7 @@ parameters: - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - @@ -15442,7 +15252,7 @@ parameters: - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - @@ -15535,11 +15345,6 @@ parameters: count: 1 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - message: "#^Parameter \\#3 \\$foreignTable of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Pdf\\\\PdfRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - message: "#^Parameter \\#4 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Pdf\\\\PdfRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" count: 2 @@ -15615,11 +15420,6 @@ parameters: count: 2 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" count: 1 @@ -15627,7 +15427,7 @@ parameters: - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - @@ -15642,7 +15442,7 @@ parameters: - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - @@ -15660,11 +15460,6 @@ parameters: count: 1 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - message: "#^Parameter \\#5 \\$foreignTable of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Svg\\\\SvgRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - message: "#^Parameter \\#6 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Svg\\\\SvgRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" count: 2 @@ -15985,11 +15780,6 @@ parameters: count: 1 path: src/Profiling.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Query/Compatibility.php - - message: "#^Cannot access offset 'AUTO_INCREMENT' on mixed\\.$#" count: 1 @@ -16425,11 +16215,6 @@ parameters: count: 1 path: src/Replication/Replication.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Replication/ReplicationGui.php - - message: "#^Cannot access offset 'Slave_IO_Running' on mixed\\.$#" count: 1 @@ -16720,11 +16505,6 @@ parameters: count: 1 path: src/Server/Privileges.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 17 - path: src/Server/Privileges.php - - message: "#^Cannot access offset 'CHARACTER_MAXIMUM…' on mixed\\.$#" count: 2 @@ -17895,11 +17675,6 @@ parameters: count: 4 path: src/SystemDatabase.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Table/ColumnsDefinition.php - - message: "#^Cannot access offset 'isEditable' on mixed\\.$#" count: 2 @@ -18050,11 +17825,6 @@ parameters: count: 2 path: src/Table/Search.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Table/Search.php - - message: "#^Cannot access offset mixed on mixed\\.$#" count: 4 @@ -18142,7 +17912,7 @@ parameters: - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 5 + count: 3 path: src/Table/Table.php - @@ -18740,11 +18510,6 @@ parameters: count: 1 path: src/Triggers/Triggers.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Triggers/Triggers.php - - message: "#^Cannot access an offset on mixed\\.$#" count: 6 @@ -18787,7 +18552,7 @@ parameters: - message: "#^Parameter \\#1 \\$identifier of static method PhpMyAdmin\\\\Util\\:\\:backquote\\(\\) expects string\\|Stringable\\|null, mixed given\\.$#" - count: 4 + count: 3 path: src/Triggers/Triggers.php - @@ -18815,21 +18580,6 @@ parameters: count: 1 path: src/Triggers/Triggers.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/TwoFactor.php - - - - message: "#^Parameter \\#1 \\$name of method PhpMyAdmin\\\\TwoFactor\\:\\:getBackendClass\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/TwoFactor.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Types.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 4 @@ -18965,11 +18715,6 @@ parameters: count: 1 path: src/Util.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 5 - path: src/Util.php - - message: "#^Cannot access offset 'Cardinality' on mixed\\.$#" count: 1 @@ -19330,11 +19075,6 @@ parameters: count: 1 path: src/ZipExtension.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: tests/classes/AbstractTestCase.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) with 'formula' and array\\{id\\: non\\-empty\\-string, name\\: string, precondition\\?\\: non\\-empty\\-string, formula\\: non\\-empty\\-string, test\\: non\\-empty\\-string, issue\\: string, recommendation\\: string, justification\\: string, \\.\\.\\.\\} will always evaluate to true\\.$#" count: 1 @@ -21070,11 +20810,6 @@ parameters: count: 1 path: tests/classes/Triggers/TriggersTest.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: tests/classes/TwoFactorTest.php - - message: "#^Method PhpMyAdmin\\\\Tests\\\\TwoFactorTest\\:\\:loadResultForConfig\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 31fd975898..33fdcd7eae 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1243,7 +1243,6 @@ - $type @@ -2079,7 +2078,6 @@ - @@ -2154,7 +2152,6 @@ - @@ -3828,7 +3825,6 @@ - $afterInsert $clauseIsUnique @@ -4418,11 +4414,8 @@ - - - __construct @@ -4540,7 +4533,6 @@ - @@ -5034,7 +5026,6 @@ - $createItem @@ -5247,7 +5238,6 @@ $itemDefinition - $itemSqlDataAccess $createRoutine @@ -7478,9 +7468,6 @@ int int - - $item - @@ -12346,15 +12333,12 @@ - - - getCreateSql @@ -12368,12 +12352,6 @@ Config::getInstance() DatabaseInterface::getInstance() - - $name - - - $name - new $cls($this) new $cls($this) diff --git a/src/ConfigStorage/Relation.php b/src/ConfigStorage/Relation.php index 43946f141b..74caa40f9b 100644 --- a/src/ConfigStorage/Relation.php +++ b/src/ConfigStorage/Relation.php @@ -1519,7 +1519,7 @@ class Relation // Check if the table already exists // use the possible replaced name first and fallback on the table name // if no replacement exists - if (! in_array($tableNameReplacements[$table] ?? $table, $existingTables)) { + if (! in_array($tableNameReplacements[$table] ?? $table, $existingTables, true)) { if (! $create) { continue; } diff --git a/src/Controllers/Database/DesignerController.php b/src/Controllers/Database/DesignerController.php index fb9b86a473..da1a2cfe87 100644 --- a/src/Controllers/Database/DesignerController.php +++ b/src/Controllers/Database/DesignerController.php @@ -197,7 +197,7 @@ class DesignerController extends AbstractController } foreach ($tablePositions as $position) { - if (in_array($position['dbName'] . '.' . $position['tableName'], $fullTableNames)) { + if (in_array($position['dbName'] . '.' . $position['tableName'], $fullTableNames, true)) { continue; } diff --git a/src/Controllers/Database/RoutinesController.php b/src/Controllers/Database/RoutinesController.php index 53bf6b3d59..80048b1fcb 100644 --- a/src/Controllers/Database/RoutinesController.php +++ b/src/Controllers/Database/RoutinesController.php @@ -64,7 +64,10 @@ class RoutinesController extends AbstractController /** * Displays the header and tabs */ - if (! empty($GLOBALS['table']) && in_array($GLOBALS['table'], $this->dbi->getTables($GLOBALS['db']))) { + if ( + ! empty($GLOBALS['table']) + && in_array($GLOBALS['table'], $this->dbi->getTables($GLOBALS['db']), true) + ) { if (! $this->checkParameters(['db', 'table'])) { return; } @@ -452,7 +455,7 @@ class RoutinesController extends AbstractController } } - if (! isset($type) || ! in_array($type, ['FUNCTION', 'PROCEDURE'])) { + if (! isset($type) || ! in_array($type, ['FUNCTION', 'PROCEDURE'], true)) { $type = null; } diff --git a/src/Controllers/Database/StructureController.php b/src/Controllers/Database/StructureController.php index 760b7c8b23..ba86d39716 100644 --- a/src/Controllers/Database/StructureController.php +++ b/src/Controllers/Database/StructureController.php @@ -557,7 +557,7 @@ class StructureController extends AbstractController if (isset($currentTable['TABLE_ROWS']) && ($currentTable['ENGINE'] != null || $tableIsView)) { // InnoDB/TokuDB table: we did not get an accurate row count $approxRows = ! $tableIsView - && in_array($currentTable['ENGINE'], ['InnoDB', 'TokuDB']) + && in_array($currentTable['ENGINE'], ['InnoDB', 'TokuDB'], true) && ! $currentTable['COUNTED']; if ($tableIsView && $currentTable['TABLE_ROWS'] >= Config::getInstance()->settings['MaxExactCountViews']) { @@ -828,7 +828,7 @@ class StructureController extends AbstractController $formattedSize = $unit = ''; if ( - (in_array($currentTable['ENGINE'], ['InnoDB', 'TokuDB']) + (in_array($currentTable['ENGINE'], ['InnoDB', 'TokuDB'], true) && $currentTable['TABLE_ROWS'] < Config::getInstance()->settings['MaxExactCount']) || ! isset($currentTable['TABLE_ROWS']) ) { diff --git a/src/Controllers/ErrorReportController.php b/src/Controllers/ErrorReportController.php index ed8a890aa5..a145279419 100644 --- a/src/Controllers/ErrorReportController.php +++ b/src/Controllers/ErrorReportController.php @@ -48,7 +48,7 @@ class ErrorReportController extends AbstractController /** @var string|null $alwaysSend */ $alwaysSend = $request->getParsedBodyParam('always_send'); - if (! in_array($exceptionType, ['js', 'php'])) { + if (! in_array($exceptionType, ['js', 'php'], true)) { return; } diff --git a/src/Controllers/Export/ExportController.php b/src/Controllers/Export/ExportController.php index 2fed20d29f..2d6f9562e9 100644 --- a/src/Controllers/Export/ExportController.php +++ b/src/Controllers/Export/ExportController.php @@ -153,7 +153,7 @@ final class ExportController extends AbstractController $separateFiles = $asSeparateFiles; } - if (in_array($compressionParam, $compressionMethods)) { + if (in_array($compressionParam, $compressionMethods, true)) { $GLOBALS['compression'] = $compressionParam; $GLOBALS['buffer_needed'] = true; } diff --git a/src/Controllers/Import/ImportController.php b/src/Controllers/Import/ImportController.php index 80cc1b5879..bedff96729 100644 --- a/src/Controllers/Import/ImportController.php +++ b/src/Controllers/Import/ImportController.php @@ -229,7 +229,7 @@ final class ImportController extends AbstractController * We only need to load the selected plugin */ - if (! in_array($GLOBALS['format'], ['csv', 'ldi', 'mediawiki', 'ods', 'shp', 'sql', 'xml'])) { + if (! in_array($GLOBALS['format'], ['csv', 'ldi', 'mediawiki', 'ods', 'shp', 'sql', 'xml'], true)) { // this should not happen for a normal user // but only during an attack $this->response->setRequestStatus(false); diff --git a/src/Controllers/Server/DatabasesController.php b/src/Controllers/Server/DatabasesController.php index b27dfb0ce7..2401c35dba 100644 --- a/src/Controllers/Server/DatabasesController.php +++ b/src/Controllers/Server/DatabasesController.php @@ -182,7 +182,7 @@ class DatabasesController extends AbstractController 'SCHEMA_DATA_FREE', ]; $this->sortBy = 'SCHEMA_NAME'; - if (in_array($sortBy, $sortByAllowList)) { + if (in_array($sortBy, $sortByAllowList, true)) { $this->sortBy = $sortBy; } } diff --git a/src/Controllers/Server/Status/VariablesController.php b/src/Controllers/Server/Status/VariablesController.php index 28b177f36d..9b6530ebe3 100644 --- a/src/Controllers/Server/Status/VariablesController.php +++ b/src/Controllers/Server/Status/VariablesController.php @@ -136,9 +136,7 @@ class VariablesController extends AbstractController */ private function flush(string $flush): void { - $flushCommands = ['STATUS', 'TABLES', 'QUERY CACHE']; - - if (! in_array($flush, $flushCommands)) { + if (! in_array($flush, ['STATUS', 'TABLES', 'QUERY CACHE'], true)) { return; } diff --git a/src/Controllers/Setup/AbstractController.php b/src/Controllers/Setup/AbstractController.php index a2042405bb..26b4ede37b 100644 --- a/src/Controllers/Setup/AbstractController.php +++ b/src/Controllers/Setup/AbstractController.php @@ -23,7 +23,7 @@ abstract class AbstractController $ignored = ['Config', 'Servers']; $pages = []; foreach (SetupFormList::getAllFormNames() as $formset) { - if (in_array($formset, $ignored)) { + if (in_array($formset, $ignored, true)) { continue; } diff --git a/src/Controllers/Table/ReplaceController.php b/src/Controllers/Table/ReplaceController.php index 88c5562a29..ad31fcac0b 100644 --- a/src/Controllers/Table/ReplaceController.php +++ b/src/Controllers/Table/ReplaceController.php @@ -76,9 +76,8 @@ final class ReplaceController extends AbstractController $this->addScriptFiles(['makegrid.js', 'sql.js', 'gis_data_editor.js']); - $afterInsertActions = ['new_insert', 'same_insert', 'edit_next']; $afterInsert = $request->getParsedBodyParam('after_insert'); - if ($afterInsert !== null && in_array($afterInsert, $afterInsertActions)) { + if (in_array($afterInsert, ['new_insert', 'same_insert', 'edit_next'], true)) { $GLOBALS['urlParams']['after_insert'] = $afterInsert; $whereClause = $request->getParsedBodyParam('where_clause'); if ($whereClause !== null) { diff --git a/src/Controllers/Table/SearchController.php b/src/Controllers/Table/SearchController.php index 54e881e1e7..82b0a72955 100644 --- a/src/Controllers/Table/SearchController.php +++ b/src/Controllers/Table/SearchController.php @@ -120,7 +120,7 @@ class SearchController extends AbstractController // before any replacement $this->originalColumnTypes[] = mb_strtolower($type); // check whether table contains geometric columns - if (in_array($type, $geomTypes)) { + if (in_array($type, $geomTypes, true)) { $this->geomColumnFlag = true; } @@ -378,8 +378,8 @@ class SearchController extends AbstractController '', ); $htmlAttributes = ''; - $isInteger = in_array($cleanType, $this->dbi->types->getIntegerTypes()); - $isFloat = in_array($cleanType, $this->dbi->types->getFloatTypes()); + $isInteger = in_array($cleanType, $this->dbi->types->getIntegerTypes(), true); + $isFloat = in_array($cleanType, $this->dbi->types->getFloatTypes(), true); if ($isInteger) { $extractedColumnspec = Util::extractColumnSpec($this->originalColumnTypes[$columnIndex]); $isUnsigned = $extractedColumnspec['unsigned']; diff --git a/src/Controllers/Table/ZoomSearchController.php b/src/Controllers/Table/ZoomSearchController.php index fa03f9638d..02d6d08348 100644 --- a/src/Controllers/Table/ZoomSearchController.php +++ b/src/Controllers/Table/ZoomSearchController.php @@ -206,7 +206,7 @@ class ZoomSearchController extends AbstractController // before any replacement $this->originalColumnTypes[] = mb_strtolower($type); // check whether table contains geometric columns - if (in_array($type, $geomTypes)) { + if (in_array($type, $geomTypes, true)) { $this->geomColumnFlag = true; } @@ -465,8 +465,8 @@ class ZoomSearchController extends AbstractController '', ); $htmlAttributes = ''; - $isInteger = in_array($cleanType, $this->dbi->types->getIntegerTypes()); - $isFloat = in_array($cleanType, $this->dbi->types->getFloatTypes()); + $isInteger = in_array($cleanType, $this->dbi->types->getIntegerTypes(), true); + $isFloat = in_array($cleanType, $this->dbi->types->getFloatTypes(), true); if ($isInteger) { $extractedColumnspec = Util::extractColumnSpec($this->originalColumnTypes[$columnIndex]); $isUnsigned = $extractedColumnspec['unsigned']; diff --git a/src/Controllers/Triggers/IndexController.php b/src/Controllers/Triggers/IndexController.php index 80385bb7e4..004467e4a0 100644 --- a/src/Controllers/Triggers/IndexController.php +++ b/src/Controllers/Triggers/IndexController.php @@ -57,7 +57,10 @@ final class IndexController extends AbstractController /** * Displays the header and tabs */ - if (! empty($GLOBALS['table']) && in_array($GLOBALS['table'], $this->dbi->getTables($GLOBALS['db']))) { + if ( + ! empty($GLOBALS['table']) + && in_array($GLOBALS['table'], $this->dbi->getTables($GLOBALS['db']), true) + ) { if (! $this->checkParameters(['db', 'table'])) { return; } diff --git a/src/Controllers/View/CreateController.php b/src/Controllers/View/CreateController.php index a7e419b9dc..b424e0a30a 100644 --- a/src/Controllers/View/CreateController.php +++ b/src/Controllers/View/CreateController.php @@ -265,7 +265,7 @@ class CreateController extends AbstractController if ( isset($view['algorithm']) - && in_array($view['algorithm'], self::VIEW_ALGORITHM_OPTIONS) + && in_array($view['algorithm'], self::VIEW_ALGORITHM_OPTIONS, true) ) { $sqlQuery .= $separator . ' ALGORITHM = ' . $view['algorithm']; } @@ -283,7 +283,7 @@ class CreateController extends AbstractController if ( isset($view['sql_security']) - && in_array($view['sql_security'], self::VIEW_SECURITY_OPTIONS) + && in_array($view['sql_security'], self::VIEW_SECURITY_OPTIONS, true) ) { $sqlQuery .= $separator . ' SQL SECURITY ' . $view['sql_security']; @@ -298,7 +298,7 @@ class CreateController extends AbstractController $sqlQuery .= $separator . ' AS ' . $view['as']; - if (isset($view['with']) && in_array($view['with'], self::VIEW_WITH_OPTIONS)) { + if (isset($view['with']) && in_array($view['with'], self::VIEW_WITH_OPTIONS, true)) { $sqlQuery .= $separator . ' WITH ' . $view['with'] . ' CHECK OPTION'; } diff --git a/src/Core.php b/src/Core.php index 00320fd9fe..4f08043ae0 100644 --- a/src/Core.php +++ b/src/Core.php @@ -85,7 +85,7 @@ class Core $phpDocLanguages = ['pt_BR', 'zh_CN', 'fr', 'de', 'ja', 'ru', 'es', 'tr']; $lang = 'en'; - if (isset($GLOBALS['lang']) && in_array($GLOBALS['lang'], $phpDocLanguages)) { + if (isset($GLOBALS['lang']) && in_array($GLOBALS['lang'], $phpDocLanguages, true)) { $lang = $GLOBALS['lang'] === 'zh_CN' ? 'zh' : $GLOBALS['lang']; } diff --git a/src/CreateAddField.php b/src/CreateAddField.php index ba355c658a..c3bef39fa5 100644 --- a/src/CreateAddField.php +++ b/src/CreateAddField.php @@ -173,7 +173,7 @@ class CreateAddField if ( $index['Index_choice'] !== 'SPATIAL' && $index['Index_choice'] !== 'FULLTEXT' - && in_array($index['Index_type'], Index::getIndexTypes()) + && in_array($index['Index_type'], Index::getIndexTypes(), true) ) { $sqlQuery .= ' USING ' . $index['Index_type']; } diff --git a/src/Database/CentralColumns.php b/src/Database/CentralColumns.php index 03c039a453..6b0a7b9b33 100644 --- a/src/Database/CentralColumns.php +++ b/src/Database/CentralColumns.php @@ -752,19 +752,19 @@ class CentralColumns foreach ($columnsList as &$row) { $vals = explode(',', $row['col_extra']); - if (in_array('BINARY', $vals)) { + if (in_array('BINARY', $vals, true)) { $row['col_attribute'] = 'BINARY'; - } elseif (in_array('UNSIGNED', $vals)) { + } elseif (in_array('UNSIGNED', $vals, true)) { $row['col_attribute'] = 'UNSIGNED'; - } elseif (in_array('UNSIGNED ZEROFILL', $vals)) { + } elseif (in_array('UNSIGNED ZEROFILL', $vals, true)) { $row['col_attribute'] = 'UNSIGNED ZEROFILL'; - } elseif (in_array('on update CURRENT_TIMESTAMP', $vals)) { + } elseif (in_array('on update CURRENT_TIMESTAMP', $vals, true)) { $row['col_attribute'] = 'on update CURRENT_TIMESTAMP'; } else { $row['col_attribute'] = ''; } - $row['col_extra'] = in_array('auto_increment', $vals) ? 'auto_increment' : ''; + $row['col_extra'] = in_array('auto_increment', $vals, true) ? 'auto_increment' : ''; } } diff --git a/src/Database/Designer/Common.php b/src/Database/Designer/Common.php index e22eb6b619..0e30d4857c 100644 --- a/src/Database/Designer/Common.php +++ b/src/Database/Designer/Common.php @@ -169,7 +169,7 @@ class Common $dtnI = $con['DTN'][$i]; $retval[$ti] = []; $retval[$ti][$cNameI] = []; - if (in_array($dtnI, $tableDbNames) && in_array($con['STN'][$i], $tableDbNames)) { + if (in_array($dtnI, $tableDbNames, true) && in_array($con['STN'][$i], $tableDbNames, true)) { $retval[$ti][$cNameI][$dtnI] = []; $retval[$ti][$cNameI][$dtnI][$con['DCN'][$i]] = [0 => $con['STN'][$i], 1 => $con['SCN'][$i]]; } diff --git a/src/Database/Events.php b/src/Database/Events.php index 616ab54b65..300aa6426f 100644 --- a/src/Database/Events.php +++ b/src/Database/Events.php @@ -269,12 +269,12 @@ class Events } $query .= 'ON SCHEDULE '; - if (! empty($_POST['item_type']) && in_array($_POST['item_type'], $this->type)) { + if (! empty($_POST['item_type']) && in_array($_POST['item_type'], $this->type, true)) { if ($_POST['item_type'] === 'RECURRING') { if ( ! empty($_POST['item_interval_value']) && ! empty($_POST['item_interval_field']) - && in_array($_POST['item_interval_field'], $this->interval) + && in_array($_POST['item_interval_field'], $this->interval, true) ) { $query .= 'EVERY ' . intval($_POST['item_interval_value']) . ' '; $query .= $_POST['item_interval_field'] . ' '; diff --git a/src/Database/Routines.php b/src/Database/Routines.php index 3b73129379..5f9b9371ec 100644 --- a/src/Database/Routines.php +++ b/src/Database/Routines.php @@ -603,7 +603,7 @@ class Routines if ( $itemType === 'PROCEDURE' && ! empty($itemParamDir[$i]) - && in_array($itemParamDir[$i], $this->directions) + && in_array($itemParamDir[$i], $this->directions, true) ) { $params .= $itemParamDir[$i] . ' ' . Util::backquote($itemParamName[$i]) @@ -642,7 +642,7 @@ class Routines if (! empty($itemParamOpsText[$i])) { if ($this->dbi->types->getTypeClass($itemParamType[$i]) === 'CHAR') { - if (! in_array($itemParamType[$i], ['VARBINARY', 'BINARY'])) { + if (! in_array($itemParamType[$i], ['VARBINARY', 'BINARY'], true)) { $params .= ' CHARSET ' . mb_strtolower($itemParamOpsText[$i]); } @@ -820,7 +820,7 @@ class Routines } $itemSqlDataAccess = $_POST['item_sqldataaccess'] ?? ''; - if (! empty($itemSqlDataAccess) && in_array($itemSqlDataAccess, $this->sqlDataAccess)) { + if (in_array($itemSqlDataAccess, $this->sqlDataAccess, true)) { $query .= $itemSqlDataAccess . ' '; } @@ -861,7 +861,7 @@ class Routines if ( ! empty($_POST['funcs'][$routine['item_param_name'][$i]]) - && in_array($_POST['funcs'][$routine['item_param_name'][$i]], $allFunctions) + && in_array($_POST['funcs'][$routine['item_param_name'][$i]], $allFunctions, true) ) { $queries[] = sprintf( 'SET @p%d=%s(%s);', @@ -1078,7 +1078,7 @@ class Routines $params[$i]['class'] = 'datefield'; } - if (in_array($routine['item_param_type'][$i], ['ENUM', 'SET'])) { + if (in_array($routine['item_param_type'][$i], ['ENUM', 'SET'], true)) { if ($routine['item_param_type'][$i] === 'ENUM') { $params[$i]['input_type'] = 'radio'; } else { diff --git a/src/Display/Results.php b/src/Display/Results.php index 9f917cfa80..6dc440dd84 100644 --- a/src/Display/Results.php +++ b/src/Display/Results.php @@ -3058,6 +3058,7 @@ class Results isset($_REQUEST['pftext']) && in_array( $_REQUEST['pftext'], [self::DISPLAY_PARTIAL_TEXT, self::DISPLAY_FULL_TEXT], + true, ) ) { $query['pftext'] = $_REQUEST['pftext']; @@ -3072,6 +3073,7 @@ class Results isset($_REQUEST['relational_display']) && in_array( $_REQUEST['relational_display'], [self::RELATIONAL_KEY, self::RELATIONAL_DISPLAY_COLUMN], + true, ) ) { $query['relational_display'] = $_REQUEST['relational_display']; @@ -3087,6 +3089,7 @@ class Results isset($_REQUEST['geoOption']) && in_array( $_REQUEST['geoOption'], [self::GEOMETRY_DISP_WKT, self::GEOMETRY_DISP_WKB, self::GEOMETRY_DISP_GEOM], + true, ) ) { $query['geoOption'] = $_REQUEST['geoOption']; diff --git a/src/Error.php b/src/Error.php index 9ae4fe52f1..4ccf5e7957 100644 --- a/src/Error.php +++ b/src/Error.php @@ -408,9 +408,9 @@ class Error extends Message '_realConnect', ]; - if (in_array($function, $includeFunctions)) { + if (in_array($function, $includeFunctions, true)) { $retval .= self::relPath($arg); - } elseif (in_array($function, $connectFunctions) && is_string($arg)) { + } elseif (in_array($function, $connectFunctions, true) && is_string($arg)) { $retval .= gettype($arg) . ' ********'; } elseif (is_scalar($arg)) { $retval .= gettype($arg) . ' ' diff --git a/src/Export/Export.php b/src/Export/Export.php index 6e45fb6956..e53d01bf7f 100644 --- a/src/Export/Export.php +++ b/src/Export/Export.php @@ -98,7 +98,7 @@ class Export /** @var string[] $handlers */ $handlers = ob_list_handlers(); - return in_array('ob_gzhandler', $handlers); + return in_array('ob_gzhandler', $handlers, true); } /** diff --git a/src/Git.php b/src/Git.php index 092bdc1421..25416874cb 100644 --- a/src/Git.php +++ b/src/Git.php @@ -367,7 +367,7 @@ class Git $dataline = array_shift($commit); $datalinearr = explode(' ', $dataline, 2); $linetype = $datalinearr[0]; - if (! in_array($linetype, ['author', 'committer'])) { + if (! in_array($linetype, ['author', 'committer'], true)) { continue; } @@ -380,7 +380,7 @@ class Git if ($linetype === 'author') { $author = $user2; - } elseif ($linetype === 'committer') { + } else { $committer = $user2; } } while ($dataline != ''); diff --git a/src/Html/Generator.php b/src/Html/Generator.php index fe163fc92c..20306c40be 100644 --- a/src/Html/Generator.php +++ b/src/Html/Generator.php @@ -908,7 +908,7 @@ class Generator // set all other attributes $attributeString = ''; foreach ($attributes as $key => $value) { - if (in_array($key, ['alt', 'title'])) { + if (in_array($key, ['alt', 'title'], true)) { continue; } diff --git a/src/InsertEdit.php b/src/InsertEdit.php index 7c749af7c5..c84703ba67 100644 --- a/src/InsertEdit.php +++ b/src/InsertEdit.php @@ -451,7 +451,7 @@ class InsertEdit } $inputMinMax = ''; - $isInteger = in_array($column->trueType, $this->dbi->types->getIntegerTypes()); + $isInteger = in_array($column->trueType, $this->dbi->types->getIntegerTypes(), true); if ($isInteger) { $extractedColumnspec = Util::extractColumnSpec($column->type); $isUnsigned = $extractedColumnspec['unsigned']; @@ -877,7 +877,7 @@ class InsertEdit public function getGotoInclude(string|false $gotoInclude): string { $validOptions = ['new_insert', 'same_insert', 'edit_next']; - if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $validOptions)) { + if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $validOptions, true)) { return '/table/change'; } @@ -1168,8 +1168,8 @@ class InsertEdit } if ( - in_array($editField->function, $this->getGisFromTextFunctions()) - || in_array($editField->function, $this->getGisFromWKBFunctions()) + in_array($editField->function, $this->getGisFromTextFunctions(), true) + || in_array($editField->function, $this->getGisFromWKBFunctions(), true) ) { preg_match('/^(\'?)(.*?)\1(?:,(\d+))?$/', $editField->value, $matches); $escapedParams = $this->dbi->quoteString($matches[2]) . (isset($matches[3]) ? ',' . $matches[3] : ''); @@ -1178,8 +1178,8 @@ class InsertEdit } if ( - ! in_array($editField->function, self::FUNC_NO_PARAM) - || ($editField->value !== '' && in_array($editField->function, self::FUNC_OPTIONAL_PARAM)) + ! in_array($editField->function, self::FUNC_NO_PARAM, true) + || ($editField->value !== '' && in_array($editField->function, self::FUNC_OPTIONAL_PARAM, true)) ) { if ( ($editField->salt !== null @@ -1956,7 +1956,7 @@ class InsertEdit } $virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED']; - if (in_array($tableColumn->extra, $virtual)) { + if (in_array($tableColumn->extra, $virtual, true)) { continue; } diff --git a/src/Language.php b/src/Language.php index e82cb774ab..2906146dd1 100644 --- a/src/Language.php +++ b/src/Language.php @@ -144,7 +144,7 @@ class Language */ public function isRTL(): bool { - return in_array($this->code, ['ar', 'fa', 'he', 'ur']); + return in_array($this->code, ['ar', 'fa', 'he', 'ur'], true); } /** diff --git a/src/Menu.php b/src/Menu.php index fc8e20e534..056f31379a 100644 --- a/src/Menu.php +++ b/src/Menu.php @@ -224,7 +224,7 @@ class Menu $tabs['structure']['icon'] = 'b_props'; $tabs['structure']['route'] = '/table/structure'; $tabs['structure']['text'] = __('Structure'); - $tabs['structure']['active'] = in_array($route, ['/table/relation', '/table/structure']); + $tabs['structure']['active'] = in_array($route, ['/table/relation', '/table/structure'], true); $tabs['sql']['icon'] = 'b_sql'; $tabs['sql']['route'] = '/table/sql'; @@ -234,7 +234,11 @@ class Menu $tabs['search']['icon'] = 'b_search'; $tabs['search']['text'] = __('Search'); $tabs['search']['route'] = '/table/search'; - $tabs['search']['active'] = in_array($route, ['/table/find-replace', '/table/search', '/table/zoom-search']); + $tabs['search']['active'] = in_array($route, [ + '/table/find-replace', + '/table/search', + '/table/zoom-search', + ], true); if (! $isSystemSchema && (! $tableIsView || $updatableView)) { $tabs['insert']['icon'] = 'b_insrow'; @@ -459,13 +463,13 @@ class Menu '/server/status/processes', '/server/status/queries', '/server/status/variables', - ]); + ], true); if ($isSuperUser || $isCreateOrGrantUser) { $tabs['rights']['icon'] = 's_rights'; $tabs['rights']['route'] = '/server/privileges'; $tabs['rights']['text'] = __('User accounts'); - $tabs['rights']['active'] = in_array($route, ['/server/privileges', '/server/user-groups']); + $tabs['rights']['active'] = in_array($route, ['/server/privileges', '/server/user-groups'], true); } $tabs['export']['icon'] = 'b_export'; @@ -490,7 +494,7 @@ class Menu '/preferences/navigation', '/preferences/sql', '/preferences/two-factor', - ]); + ], true); if (! empty($binaryLogs)) { $tabs['binlog']['icon'] = 's_tbl'; diff --git a/src/Navigation/NavigationTree.php b/src/Navigation/NavigationTree.php index 49db35b76c..b98c382af7 100644 --- a/src/Navigation/NavigationTree.php +++ b/src/Navigation/NavigationTree.php @@ -552,45 +552,45 @@ class NavigationTree // Get items to hide $hidden = $db->getHiddenItems($this->relationParameters, 'group'); $config = Config::getInstance(); - if (! $config->settings['NavigationTreeShowTables'] && ! in_array('tables', $hidden)) { + if (! $config->settings['NavigationTreeShowTables'] && ! in_array('tables', $hidden, true)) { $hidden[] = 'tables'; } - if (! $config->settings['NavigationTreeShowViews'] && ! in_array('views', $hidden)) { + if (! $config->settings['NavigationTreeShowViews'] && ! in_array('views', $hidden, true)) { $hidden[] = 'views'; } - if (! $config->settings['NavigationTreeShowFunctions'] && ! in_array('functions', $hidden)) { + if (! $config->settings['NavigationTreeShowFunctions'] && ! in_array('functions', $hidden, true)) { $hidden[] = 'functions'; } - if (! $config->settings['NavigationTreeShowProcedures'] && ! in_array('procedures', $hidden)) { + if (! $config->settings['NavigationTreeShowProcedures'] && ! in_array('procedures', $hidden, true)) { $hidden[] = 'procedures'; } - if (! $config->settings['NavigationTreeShowEvents'] && ! in_array('events', $hidden)) { + if (! $config->settings['NavigationTreeShowEvents'] && ! in_array('events', $hidden, true)) { $hidden[] = 'events'; } $retval = []; if (! $db->hasChildren()) { - if (! in_array('tables', $hidden) && $db->getPresence('tables')) { + if (! in_array('tables', $hidden, true) && $db->getPresence('tables')) { $retval['tables'] = new NodeTableContainer(); } - if (! in_array('views', $hidden) && $db->getPresence('views')) { + if (! in_array('views', $hidden, true) && $db->getPresence('views')) { $retval['views'] = new NodeViewContainer(); } - if (! in_array('functions', $hidden) && $db->getPresence('functions')) { + if (! in_array('functions', $hidden, true) && $db->getPresence('functions')) { $retval['functions'] = new NodeFunctionContainer(); } - if (! in_array('procedures', $hidden) && $db->getPresence('procedures')) { + if (! in_array('procedures', $hidden, true) && $db->getPresence('procedures')) { $retval['procedures'] = new NodeProcedureContainer(); } - if (! in_array('events', $hidden) && $db->getPresence('events')) { + if (! in_array('events', $hidden, true) && $db->getPresence('events')) { $retval['events'] = new NodeEventContainer(); } @@ -1031,8 +1031,8 @@ class NavigationTree // if node name itself is in sterile, then allow $nodeIsGroup = $node->isGroup - || (! in_array($parentName, $sterile) && ! $node->isNew) - || (in_array($node->realName, $sterile) && $node->children !== []); + || (! in_array($parentName, $sterile, true) && ! $node->isNew) + || (in_array($node->realName, $sterile, true) && $node->children !== []); if ($nodeIsGroup) { $match = $this->findTreeMatch($this->vPath, $paths['vPath_clean']); $linkClasses = $node->getCssClasses($match); diff --git a/src/Navigation/Nodes/Node.php b/src/Navigation/Nodes/Node.php index 87e3cff3e4..b42bed8760 100644 --- a/src/Navigation/Nodes/Node.php +++ b/src/Navigation/Nodes/Node.php @@ -786,7 +786,7 @@ class Node continue; } - if (in_array($arr[0], $retval)) { + if (in_array($arr[0], $retval, true)) { continue; } @@ -844,7 +844,7 @@ class Node continue; } - if (in_array($arr[0], $retval)) { + if (in_array($arr[0], $retval, true)) { continue; } diff --git a/src/Navigation/Nodes/NodeDatabase.php b/src/Navigation/Nodes/NodeDatabase.php index aff0415a29..e967f0e7ff 100644 --- a/src/Navigation/Nodes/NodeDatabase.php +++ b/src/Navigation/Nodes/NodeDatabase.php @@ -276,7 +276,7 @@ class NodeDatabase extends Node if ($relationParameters->navigationItemsHidingFeature !== null) { $hiddenItems = $this->getHiddenItems($relationParameters, substr($type, 0, -1)); foreach ($retval as $key => $item) { - if (! in_array($item, $hiddenItems)) { + if (! in_array($item, $hiddenItems, true)) { continue; } diff --git a/src/Normalization.php b/src/Normalization.php index cf43893358..80e62494ef 100644 --- a/src/Normalization.php +++ b/src/Normalization.php @@ -74,7 +74,11 @@ class Normalization $column = $def->field; $extractedColumnSpec = Util::extractColumnSpec($def->type); - if ($columnTypeList !== [] && ! in_array(mb_strtoupper($extractedColumnSpec['type']), $columnTypeList)) { + if ( + $columnTypeList !== [] && ! in_array(mb_strtoupper( + $extractedColumnSpec['type'], + ), $columnTypeList, true) + ) { continue; } @@ -411,7 +415,7 @@ class Normalization ); $cnt = 0; foreach ($columns as $column) { - if (in_array($column, $pk)) { + if (in_array($column, $pk, true)) { continue; } @@ -691,7 +695,7 @@ class Normalization ); $query = 'ALTER TABLE ' . Util::backquote($originalTable); foreach ($columns as $col) { - if (in_array($col, $colPresent)) { + if (in_array($col, $colPresent, true)) { continue; } @@ -836,7 +840,7 @@ class Normalization } foreach ($columns as $column) { - if (in_array($column, $pk)) { + if (in_array($column, $pk, true)) { continue; } @@ -846,7 +850,7 @@ class Normalization } foreach ($columns as $column) { - if (in_array($column, $pk)) { + if (in_array($column, $pk, true)) { continue; } @@ -913,7 +917,7 @@ class Normalization $table, ); foreach ($columns as $column) { - if (in_array($column, $pk)) { + if (in_array($column, $pk, true)) { continue; } diff --git a/src/Plugins/Auth/AuthenticationSignon.php b/src/Plugins/Auth/AuthenticationSignon.php index bd9b7f467b..2def1e4df1 100644 --- a/src/Plugins/Auth/AuthenticationSignon.php +++ b/src/Plugins/Auth/AuthenticationSignon.php @@ -78,7 +78,7 @@ class AuthenticationSignon extends AuthenticationPlugin if ( isset($sessionCookieParams['samesite']) - && ! in_array($sessionCookieParams['samesite'], ['Lax', 'Strict']) + && ! in_array($sessionCookieParams['samesite'], ['Lax', 'Strict'], true) ) { // Not a valid value for samesite unset($sessionCookieParams['samesite']); diff --git a/src/Plugins/Export/ExportHtmlword.php b/src/Plugins/Export/ExportHtmlword.php index fe87c9ea8d..4695189055 100644 --- a/src/Plugins/Export/ExportHtmlword.php +++ b/src/Plugins/Export/ExportHtmlword.php @@ -584,7 +584,7 @@ class ExportHtmlword extends ExportPlugin $fmtPre = ''; $fmtPost = ''; - if (in_array($column->field, $uniqueKeys)) { + if (in_array($column->field, $uniqueKeys, true)) { $fmtPre = '' . $fmtPre; $fmtPost .= ''; } diff --git a/src/Plugins/Export/ExportLatex.php b/src/Plugins/Export/ExportLatex.php index f705fd00e2..d74ee2eb36 100644 --- a/src/Plugins/Export/ExportLatex.php +++ b/src/Plugins/Export/ExportLatex.php @@ -598,7 +598,7 @@ class ExportLatex extends ExportPlugin $localBuffer = '\\textit{' . mb_substr($localBuffer, 0, $pos) . '}' . mb_substr($localBuffer, $pos); } - if (in_array($fieldName, $uniqueKeys)) { + if (in_array($fieldName, $uniqueKeys, true)) { $pos = (int) mb_strpos($localBuffer, "\000"); $localBuffer = '\\textbf{' . mb_substr($localBuffer, 0, $pos) . '}' . mb_substr($localBuffer, $pos); } diff --git a/src/Plugins/Export/ExportTexytext.php b/src/Plugins/Export/ExportTexytext.php index c6c3681a0b..98befb3d9a 100644 --- a/src/Plugins/Export/ExportTexytext.php +++ b/src/Plugins/Export/ExportTexytext.php @@ -540,7 +540,7 @@ class ExportTexytext extends ExportPlugin $fmtPre = ''; $fmtPost = ''; - if (in_array($column->field, $uniqueKeys)) { + if (in_array($column->field, $uniqueKeys, true)) { $fmtPre = '**' . $fmtPre; $fmtPost .= '**'; } diff --git a/src/Plugins/Schema/Dia/DiaRelationSchema.php b/src/Plugins/Schema/Dia/DiaRelationSchema.php index 4f46cffa6d..c3b94b09f2 100644 --- a/src/Plugins/Schema/Dia/DiaRelationSchema.php +++ b/src/Plugins/Schema/Dia/DiaRelationSchema.php @@ -102,7 +102,7 @@ class DiaRelationSchema extends ExportRelationSchema // put the foreign table on the schema only if selected by the user // (do not use array_search() because we would have to do a === false and this is not PHP3 compatible) if ($masterField !== 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { + if (in_array($rel['foreign_table'], $alltables, true)) { $this->addRelation( $oneTable, $masterField, @@ -116,7 +116,7 @@ class DiaRelationSchema extends ExportRelationSchema } foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables)) { + if (! in_array($oneKey['ref_table_name'], $alltables, true)) { continue; } diff --git a/src/Plugins/Schema/Eps/EpsRelationSchema.php b/src/Plugins/Schema/Eps/EpsRelationSchema.php index 3d28c28469..20b43e8fb5 100644 --- a/src/Plugins/Schema/Eps/EpsRelationSchema.php +++ b/src/Plugins/Schema/Eps/EpsRelationSchema.php @@ -111,7 +111,7 @@ class EpsRelationSchema extends ExportRelationSchema * to do a === false and this is not PHP3 compatible) */ if ($masterField !== 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { + if (in_array($rel['foreign_table'], $alltables, true)) { $this->addRelation( $oneTable, $this->eps->getFont(), @@ -127,7 +127,7 @@ class EpsRelationSchema extends ExportRelationSchema } foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables)) { + if (! in_array($oneKey['ref_table_name'], $alltables, true)) { continue; } diff --git a/src/Plugins/Schema/Pdf/PdfRelationSchema.php b/src/Plugins/Schema/Pdf/PdfRelationSchema.php index 9cd8990fee..094fb74ebd 100644 --- a/src/Plugins/Schema/Pdf/PdfRelationSchema.php +++ b/src/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -211,7 +211,7 @@ class PdfRelationSchema extends ExportRelationSchema // (do not use array_search() because we would have to // to do a === false and this is not PHP3 compatible) if ($masterField !== 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { + if (in_array($rel['foreign_table'], $alltables, true)) { $this->addRelation($oneTable, $masterField, $rel['foreign_table'], $rel['foreign_field']); } @@ -219,7 +219,7 @@ class PdfRelationSchema extends ExportRelationSchema } foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables)) { + if (! in_array($oneKey['ref_table_name'], $alltables, true)) { continue; } diff --git a/src/Plugins/Schema/Svg/SvgRelationSchema.php b/src/Plugins/Schema/Svg/SvgRelationSchema.php index 32363d4928..79f6cd7436 100644 --- a/src/Plugins/Schema/Svg/SvgRelationSchema.php +++ b/src/Plugins/Schema/Svg/SvgRelationSchema.php @@ -126,7 +126,7 @@ class SvgRelationSchema extends ExportRelationSchema * to do a === false and this is not PHP3 compatible) */ if ($masterField !== 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { + if (in_array($rel['foreign_table'], $alltables, true)) { $this->addRelation( $oneTable, $this->svg->getFont(), @@ -142,7 +142,7 @@ class SvgRelationSchema extends ExportRelationSchema } foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables)) { + if (! in_array($oneKey['ref_table_name'], $alltables, true)) { continue; } diff --git a/src/Query/Compatibility.php b/src/Query/Compatibility.php index 75279cfae3..327837570a 100644 --- a/src/Query/Compatibility.php +++ b/src/Query/Compatibility.php @@ -185,7 +185,7 @@ class Compatibility // except TINYINT(1). // See: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html $integerTypes = ['SMALLINT', 'MEDIUMINT', 'INT', 'BIGINT']; - $typeLengthNotAllowed = in_array($type, $integerTypes) || $type === 'TINYINT' && $length !== '1'; + $typeLengthNotAllowed = in_array($type, $integerTypes, true) || $type === 'TINYINT' && $length !== '1'; return ! (self::isIntegersLengthRestricted($dbi) && $typeLengthNotAllowed); } diff --git a/src/Replication/ReplicationGui.php b/src/Replication/ReplicationGui.php index 5a07548c5b..801f82c1cb 100644 --- a/src/Replication/ReplicationGui.php +++ b/src/Replication/ReplicationGui.php @@ -290,7 +290,7 @@ class ReplicationGui 'Replicate_Wild_Do_Table', 'Replicate_Wild_Ignore_Table', ]; - if (! in_array($variable, $variablesWrap)) { + if (! in_array($variable, $variablesWrap, true)) { continue; } diff --git a/src/Server/Privileges.php b/src/Server/Privileges.php index dd80c22b5d..b4d90c88be 100644 --- a/src/Server/Privileges.php +++ b/src/Server/Privileges.php @@ -183,7 +183,7 @@ class Privileges $usersGrants = explode(',', $row['Table_priv']); foreach ($avGrants as $currentGrant) { - $row[$currentGrant . '_priv'] = in_array($currentGrant, $usersGrants) ? 'Y' : 'N'; + $row[$currentGrant . '_priv'] = in_array($currentGrant, $usersGrants, true) ? 'Y' : 'N'; } unset($row['Table_priv']); @@ -1462,7 +1462,7 @@ class Privileges $dbRightsSqls = []; foreach ($tablesToSearchForUsers as $tableSearchIn) { - if (! in_array($tableSearchIn, $tables)) { + if (! in_array($tableSearchIn, $tables, true)) { continue; } @@ -1614,6 +1614,7 @@ class Privileges $onePrivilege['grant'] = in_array( 'Grant', explode(',', $row['Table_priv']), + true, ); $onePrivilege['column_privs'] = ! empty($row['Column_priv']); $onePrivilege['privileges'] = implode(',', $this->extractPrivInfo($row, true)); @@ -1625,6 +1626,7 @@ class Privileges $onePrivilege['grant'] = in_array( 'Grant', explode(',', $row['Proc_priv']), + true, ); $privs = $this->parseProcPriv($row['Proc_priv']); @@ -1682,7 +1684,7 @@ class Privileges $databases = []; $escapedDatabases = []; foreach ($predDbArray as $currentDb) { - if (in_array($currentDb, $databasesToSkip)) { + if (in_array($currentDb, $databasesToSkip, true)) { continue; } @@ -1691,7 +1693,7 @@ class Privileges // because the list of databases has special characters // already escaped in $foundRows, // contrary to the output of SHOW DATABASES - if (in_array($currentDbEscaped, $foundRows)) { + if (in_array($currentDbEscaped, $foundRows, true)) { continue; } @@ -1707,7 +1709,7 @@ class Privileges $tables = []; if ($result) { while ($row = $result->fetchRow()) { - if (in_array($row[0], $foundRows)) { + if (in_array($row[0], $foundRows, true)) { continue; } @@ -1721,7 +1723,7 @@ class Privileges $routines = []; foreach ($routineData as $routine) { - if (in_array($routine['name'], $foundRows)) { + if (in_array($routine['name'], $foundRows, true)) { continue; } @@ -2797,38 +2799,38 @@ class Privileges while ($row2 = $res2->fetchAssoc()) { $tmpArray = explode(',', $row2['Column_priv']); - if (in_array('Select', $tmpArray)) { + if (in_array('Select', $tmpArray, true)) { $tmpPrivs2['Select'][] = $row2['Column_name']; } - if (in_array('Insert', $tmpArray)) { + if (in_array('Insert', $tmpArray, true)) { $tmpPrivs2['Insert'][] = $row2['Column_name']; } - if (in_array('Update', $tmpArray)) { + if (in_array('Update', $tmpArray, true)) { $tmpPrivs2['Update'][] = $row2['Column_name']; } - if (! in_array('References', $tmpArray)) { + if (! in_array('References', $tmpArray, true)) { continue; } $tmpPrivs2['References'][] = $row2['Column_name']; } - if ($tmpPrivs2['Select'] !== [] && ! in_array('SELECT', $tmpPrivs1)) { + if ($tmpPrivs2['Select'] !== [] && ! in_array('SELECT', $tmpPrivs1, true)) { $tmpPrivs1[] = 'SELECT (`' . implode('`, `', $tmpPrivs2['Select']) . '`)'; } - if ($tmpPrivs2['Insert'] !== [] && ! in_array('INSERT', $tmpPrivs1)) { + if ($tmpPrivs2['Insert'] !== [] && ! in_array('INSERT', $tmpPrivs1, true)) { $tmpPrivs1[] = 'INSERT (`' . implode('`, `', $tmpPrivs2['Insert']) . '`)'; } - if ($tmpPrivs2['Update'] !== [] && ! in_array('UPDATE', $tmpPrivs1)) { + if ($tmpPrivs2['Update'] !== [] && ! in_array('UPDATE', $tmpPrivs1, true)) { $tmpPrivs1[] = 'UPDATE (`' . implode('`, `', $tmpPrivs2['Update']) . '`)'; } - if ($tmpPrivs2['References'] !== [] && ! in_array('REFERENCES', $tmpPrivs1)) { + if ($tmpPrivs2['References'] !== [] && ! in_array('REFERENCES', $tmpPrivs1, true)) { $tmpPrivs1[] = 'REFERENCES (`' . implode('`, `', $tmpPrivs2['References']) . '`)'; } @@ -2837,7 +2839,7 @@ class Privileges . Util::backquote($row['Table_name']) . ' TO ' . $this->dbi->quoteString($username) . '@' . $this->dbi->quoteString($hostname) - . (in_array('Grant', explode(',', $row['Table_priv'])) + . (in_array('Grant', explode(',', $row['Table_priv']), true) ? ' WITH GRANT OPTION;' : ';'); } diff --git a/src/Table/ColumnsDefinition.php b/src/Table/ColumnsDefinition.php index 5d5e34d116..130d4eb6bb 100644 --- a/src/Table/ColumnsDefinition.php +++ b/src/Table/ColumnsDefinition.php @@ -180,7 +180,7 @@ final class ColumnsDefinition } elseif (isset($fieldsMeta[$columnNumber])) { $columnMeta = $fieldsMeta[$columnNumber]; $virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED']; - if (in_array($columnMeta['Extra'], $virtual)) { + if (in_array($columnMeta['Extra'], $virtual, true)) { $tableObj = new Table($GLOBALS['table'], $GLOBALS['db'], $this->dbi); $expressions = $tableObj->getColumnGenerationExpression($columnMeta['Field']); $columnMeta['Expression'] = is_array($expressions) ? $expressions[$columnMeta['Field']] : null; diff --git a/src/Table/Search.php b/src/Table/Search.php index d84a13a2ce..f88ec8a351 100644 --- a/src/Table/Search.php +++ b/src/Table/Search.php @@ -287,7 +287,7 @@ final class Search // If the where clause is something like 'IsEmpty(`spatial_col_name`)' if (isset($geomUnaryFunctions[$geomFunc]) && trim($criteriaValues) == '') { $where = $geomFunctionApplied; - } elseif (in_array($type, Gis::getDataTypes()) && ! empty($criteriaValues)) { + } elseif (in_array($type, Gis::getDataTypes(), true) && ! empty($criteriaValues)) { // create gis data from the criteria input $gisData = Gis::createData($criteriaValues, $this->dbi->getVersion()); $where = $geomFunctionApplied . ' ' . $funcType . ' ' . $gisData; diff --git a/src/Table/Table.php b/src/Table/Table.php index 6bd75a5063..fa29abe48d 100644 --- a/src/Table/Table.php +++ b/src/Table/Table.php @@ -1475,7 +1475,7 @@ class Table implements Stringable } // a column might have a primary and an unique index on it - if (in_array($possibleColumn, $return)) { + if (in_array($possibleColumn, $return, true)) { continue; } @@ -2007,7 +2007,7 @@ class Table implements Stringable if ( $index->getChoice() !== 'SPATIAL' && $index->getChoice() !== 'FULLTEXT' - && in_array($type, Index::getIndexTypes()) + && in_array($type, Index::getIndexTypes(), true) && ! $this->isEngine('TOKUDB') ) { $sqlQuery .= ' USING ' . $type; diff --git a/src/Triggers/Triggers.php b/src/Triggers/Triggers.php index dab916b121..06cd31dd83 100644 --- a/src/Triggers/Triggers.php +++ b/src/Triggers/Triggers.php @@ -191,20 +191,23 @@ class Triggers $GLOBALS['errors'][] = __('You must provide a trigger name!'); } - if (! empty($_POST['item_timing']) && in_array($_POST['item_timing'], $this->time)) { + if (! empty($_POST['item_timing']) && in_array($_POST['item_timing'], $this->time, true)) { $query .= $_POST['item_timing'] . ' '; } else { $GLOBALS['errors'][] = __('You must provide a valid timing for the trigger!'); } - if (! empty($_POST['item_event']) && in_array($_POST['item_event'], $this->event)) { + if (! empty($_POST['item_event']) && in_array($_POST['item_event'], $this->event, true)) { $query .= $_POST['item_event'] . ' '; } else { $GLOBALS['errors'][] = __('You must provide a valid event for the trigger!'); } $query .= 'ON '; - if (! empty($_POST['item_table']) && in_array($_POST['item_table'], $this->dbi->getTables($GLOBALS['db']))) { + if ( + ! empty($_POST['item_table']) + && in_array($_POST['item_table'], $this->dbi->getTables($GLOBALS['db']), true) + ) { $query .= Util::backquote($_POST['item_table']); } else { $GLOBALS['errors'][] = __('You must provide a valid table name!'); diff --git a/src/TwoFactor.php b/src/TwoFactor.php index 822045ad0c..309916f205 100644 --- a/src/TwoFactor.php +++ b/src/TwoFactor.php @@ -42,7 +42,7 @@ class TwoFactor protected TwoFactorPlugin $backend; - /** @var mixed[] */ + /** @var string[] */ protected array $available; private UserPreferences $userPreferences; @@ -101,7 +101,7 @@ class TwoFactor return $this->backend; } - /** @return mixed[] */ + /** @return string[] */ public function getAvailable(): array { return $this->available; @@ -174,7 +174,7 @@ class TwoFactor public function getBackendClass(string $name): string { $result = TwoFactorPlugin::class; - if (in_array($name, $this->available)) { + if (in_array($name, $this->available, true)) { /** @psalm-var class-string $result */ $result = 'PhpMyAdmin\\Plugins\\TwoFactor\\' . ucfirst($name); } elseif ($name !== '') { @@ -257,7 +257,7 @@ class TwoFactor $cls = $this->getBackendClass($name); $this->backend = new $cls($this); } else { - if (! in_array($name, $this->available)) { + if (! in_array($name, $this->available, true)) { return false; } diff --git a/src/Types.php b/src/Types.php index 5b04d99b50..be78080e78 100644 --- a/src/Types.php +++ b/src/Types.php @@ -47,7 +47,7 @@ class Types */ public function isUnaryOperator(string $op): bool { - return in_array($op, $this->getUnaryOperators()); + return in_array($op, $this->getUnaryOperators(), true); } /** diff --git a/src/Util.php b/src/Util.php index 60d9121e55..9ad79ae894 100644 --- a/src/Util.php +++ b/src/Util.php @@ -95,7 +95,7 @@ class Util */ public static function showIcons(string $value): bool { - return in_array(Config::getInstance()->settings[$value], ['icons', 'both']); + return in_array(Config::getInstance()->settings[$value], ['icons', 'both'], true); } /** @@ -105,7 +105,7 @@ class Util */ public static function showText(string $value): bool { - return in_array(Config::getInstance()->settings[$value], ['text', 'both']); + return in_array(Config::getInstance()->settings[$value], ['text', 'both'], true); } /** @@ -1819,7 +1819,7 @@ class Util $whereAdded = true; } - if (isset($_REQUEST['tbl_type']) && in_array($_REQUEST['tbl_type'], ['table', 'view'])) { + if (isset($_REQUEST['tbl_type']) && in_array($_REQUEST['tbl_type'], ['table', 'view'], true)) { $tblGroupSql .= $whereAdded ? ' AND' : ' WHERE'; if ($_REQUEST['tbl_type'] === 'view') { $tblGroupSql .= " `Table_type` NOT IN ('BASE TABLE', 'SYSTEM VERSIONED')"; @@ -2055,7 +2055,7 @@ class Util 'sort_order' => $futureSortOrder, ]; - if (isset($_REQUEST['tbl_type']) && in_array($_REQUEST['tbl_type'], ['view', 'table'])) { + if (isset($_REQUEST['tbl_type']) && in_array($_REQUEST['tbl_type'], ['view', 'table'], true)) { $urlParams['tbl_type'] = $_REQUEST['tbl_type']; } @@ -2098,7 +2098,7 @@ class Util [$keyName, $value] = $keyValueArray; $value = trim(strtolower($value)); - if (strtolower(trim($keyName)) === 'proto' && in_array($value, ['http', 'https'])) { + if (strtolower(trim($keyName)) === 'proto' && in_array($value, ['http', 'https'], true)) { return $value; } } diff --git a/tests/classes/AbstractTestCase.php b/tests/classes/AbstractTestCase.php index cbde2d83c5..470baea158 100644 --- a/tests/classes/AbstractTestCase.php +++ b/tests/classes/AbstractTestCase.php @@ -50,7 +50,7 @@ abstract class AbstractTestCase extends TestCase protected function setUp(): void { foreach (array_keys($GLOBALS) as $key) { - if (in_array($key, $this->globalsAllowList)) { + if (in_array($key, $this->globalsAllowList, true)) { continue; } @@ -189,7 +189,7 @@ abstract class AbstractTestCase extends TestCase Config::$instance = null; (new ReflectionProperty(Template::class, 'twig'))->setValue(null, null); foreach (array_keys($GLOBALS) as $key) { - if (in_array($key, $this->globalsAllowList)) { + if (in_array($key, $this->globalsAllowList, true)) { continue; } diff --git a/tests/classes/TwoFactorTest.php b/tests/classes/TwoFactorTest.php index 72404b0206..50a7dbaeeb 100644 --- a/tests/classes/TwoFactorTest.php +++ b/tests/classes/TwoFactorTest.php @@ -255,7 +255,7 @@ class TwoFactorTest extends AbstractTestCase $request = new ServerRequest($this->createStub(ServerRequestInterface::class)); $object = $this->getTwoFactorAndLoadConfig('user', null); - if (! in_array('application', $object->getAvailable())) { + if (! in_array('application', $object->getAvailable(), true)) { $this->markTestSkipped('google2fa not available'); } @@ -309,7 +309,7 @@ class TwoFactorTest extends AbstractTestCase $request = new ServerRequest($this->createStub(ServerRequestInterface::class)); $object = $this->getTwoFactorAndLoadConfig('user', null); - if (! in_array('key', $object->getAvailable())) { + if (! in_array('key', $object->getAvailable(), true)) { $this->markTestSkipped('u2f-php-server not available'); } @@ -375,7 +375,7 @@ class TwoFactorTest extends AbstractTestCase $request = new ServerRequest($this->createStub(ServerRequestInterface::class)); $object = $this->getTwoFactorAndLoadConfig('user', null); - if (! in_array('key', $object->getAvailable())) { + if (! in_array('key', $object->getAvailable(), true)) { $this->markTestSkipped('u2f-php-server not available'); }