Skip to content

Commit ef941c2

Browse files
Merge pull request phpmyadmin#18083 from kamil-tekiela/Fix-PHP-8-issues
Fix PHP 8 issues due to changed internal functions
2 parents 3716f94 + 5c5eeb9 commit ef941c2

File tree

4 files changed

+3
-36
lines changed

4 files changed

+3
-36
lines changed

libraries/classes/InsertEdit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ private function getSpecialCharsAndBackupFieldForInsertingMode(
11321132
$specialChars = bin2hex($column['Default']);
11331133
} elseif (substr($trueType, -4) === 'text') {
11341134
$textDefault = substr($column['Default'], 1, -1);
1135-
$specialChars = stripcslashes($textDefault !== false ? $textDefault : $column['Default']);
1135+
$specialChars = stripcslashes($textDefault !== '' ? $textDefault : $column['Default']);
11361136
} else {
11371137
$specialChars = htmlspecialchars($column['Default']);
11381138
}

libraries/classes/ZipExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ public function createFile($data, $name, $time = 0)
236236

237237
$data = $newData;
238238
} elseif (is_array($data) && is_array($name) && count($data) === count($name)) {
239-
/** @var array $data */
240239
$data = array_combine($name, $data);
241240
} else {
242241
return false;
@@ -269,7 +268,7 @@ public function createFile($data, $name, $time = 0)
269268
$uncLen = strlen($dump);
270269
$crc = crc32($dump);
271270
$zdata = (string) gzcompress($dump);
272-
$zdata = substr((string) substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug
271+
$zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug
273272
$cLen = strlen($zdata);
274273
$fr = "\x50\x4b\x03\x04"
275274
. "\x14\x00" // ver needed to extract

phpstan-baseline.neon

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4895,11 +4895,6 @@ parameters:
48954895
count: 1
48964896
path: libraries/classes/IndexColumn.php
48974897

4898-
-
4899-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
4900-
count: 1
4901-
path: libraries/classes/InsertEdit.php
4902-
49034898
-
49044899
message: "#^Method PhpMyAdmin\\\\InsertEdit\\:\\:analyzeTableColumnsArray\\(\\) has parameter \\$column with no value type specified in iterable type array\\.$#"
49054900
count: 1
@@ -5245,11 +5240,6 @@ parameters:
52455240
count: 1
52465241
path: libraries/classes/InsertEdit.php
52475242

5248-
-
5249-
message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#"
5250-
count: 1
5251-
path: libraries/classes/InsertEdit.php
5252-
52535243
-
52545244
message: "#^Method PhpMyAdmin\\\\InternalRelations\\:\\:getInformationSchema\\(\\) return type has no value type specified in iterable type array\\.$#"
52555245
count: 1
@@ -9165,11 +9155,6 @@ parameters:
91659155
count: 1
91669156
path: libraries/classes/VersionInformation.php
91679157

9168-
-
9169-
message: "#^Casting to string something that's already string\\.$#"
9170-
count: 1
9171-
path: libraries/classes/ZipExtension.php
9172-
91739158
-
91749159
message: "#^Method PhpMyAdmin\\\\ZipExtension\\:\\:createFile\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
91759160
count: 1
@@ -9190,11 +9175,6 @@ parameters:
91909175
count: 1
91919176
path: libraries/classes/ZipExtension.php
91929177

9193-
-
9194-
message: "#^PHPDoc tag @var for variable \\$data has no value type specified in iterable type array\\.$#"
9195-
count: 1
9196-
path: libraries/classes/ZipExtension.php
9197-
91989178
-
91999179
message: "#^Call to function method_exists\\(\\) with 'PHPUnit\\\\\\\\Framework\\\\\\\\TestCase' and 'assertFileDoesNotEx…' will always evaluate to true\\.$#"
92009180
count: 1

psalm-baseline.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9271,9 +9271,6 @@
92719271
</PossiblyUnusedMethod>
92729272
</file>
92739273
<file src="libraries/classes/InsertEdit.php">
9274-
<DocblockTypeContradiction>
9275-
<code>$column['Default']</code>
9276-
</DocblockTypeContradiction>
92779274
<InvalidArgument>
92789275
<code>$urlParams</code>
92799276
</InvalidArgument>
@@ -9364,7 +9361,7 @@
93649361
<code>$specialChars</code>
93659362
<code>$specialChars</code>
93669363
<code>$specialCharsEncoded</code>
9367-
<code>$textDefault !== false ? $textDefault : $column['Default']</code>
9364+
<code>$textDefault !== '' ? $textDefault : $column['Default']</code>
93689365
<code>$transformationPlugin-&gt;getScripts()</code>
93699366
<code>$transformation[$type . '_options'] ?? ''</code>
93709367
<code>$trueType</code>
@@ -9515,9 +9512,6 @@
95159512
<RedundantCast>
95169513
<code>(int) $GLOBALS['cfg']['InsertRows']</code>
95179514
</RedundantCast>
9518-
<RedundantConditionGivenDocblockType>
9519-
<code>$textDefault !== false</code>
9520-
</RedundantConditionGivenDocblockType>
95219515
</file>
95229516
<file src="libraries/classes/IpAllowDeny.php">
95239517
<InvalidArrayOffset>
@@ -16301,12 +16295,6 @@
1630116295
<PossiblyUnusedParam>
1630216296
<code>$time</code>
1630316297
</PossiblyUnusedParam>
16304-
<RedundantCastGivenDocblockType>
16305-
<code>(string) substr($zdata, 0, strlen($zdata) - 4)</code>
16306-
</RedundantCastGivenDocblockType>
16307-
<UnnecessaryVarAnnotation>
16308-
<code>array</code>
16309-
</UnnecessaryVarAnnotation>
1631016298
</file>
1631116299
<file src="libraries/config.default.php">
1631216300
<UnusedVariable>

0 commit comments

Comments
 (0)