Browse Source

Merge pull request #22288 from nextcloud/techdebt/noid/fix-oc_image-invalid-scalar-arguments

Cast float/char to int to avoid invalid scalar argument warning
tags/v20.0.0beta1
Morris Jobke 3 years ago
parent
commit
60be722ee8
No account linked to committer's email address
2 changed files with 3 additions and 5 deletions
  1. 1
    3
      build/psalm-baseline.xml
  2. 2
    2
      lib/private/legacy/OC_Image.php

+ 1
- 3
build/psalm-baseline.xml View File

@@ -6036,9 +6036,7 @@
<InvalidReturnType occurrences="1">
<code>bool</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="19">
<code>$bits</code>
<code>$lastIndex</code>
<InvalidScalarArgument occurrences="17">
<code>$this-&gt;bitDepth</code>
<code>90</code>
<code>$imagePath</code>

+ 2
- 2
lib/private/legacy/OC_Image.php View File

@@ -1175,7 +1175,7 @@ if (!function_exists('imagebmp')) {
} elseif ($bit == 32) {
$bit = 24;
}
$bits = pow(2, $bit);
$bits = (int)pow(2, $bit);
imagetruecolortopalette($im, true, $bits);
$width = imagesx($im);
$height = imagesy($im);
@@ -1211,7 +1211,7 @@ if (!function_exists('imagebmp')) {
} // RLE8
elseif ($compression == 1 && $bit == 8) {
for ($j = $height - 1; $j >= 0; $j--) {
$lastIndex = "\0";
$lastIndex = 0;
$sameNum = 0;
for ($i = 0; $i <= $width; $i++) {
$index = imagecolorat($im, $i, $j);

Loading…
Cancel
Save