Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6045,9 +6045,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>
Expand Down
4 changes: 2 additions & 2 deletions lib/private/legacy/OC_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) {
} elseif ($bit == 32) {
$bit = 24;
}
$bits = pow(2, $bit);
$bits = (int)pow(2, $bit);
imagetruecolortopalette($im, true, $bits);
$width = imagesx($im);
$height = imagesy($im);
Expand Down Expand Up @@ -1211,7 +1211,7 @@ function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) {
} // RLE8
elseif ($compression == 1 && $bit == 8) {
for ($j = $height - 1; $j >= 0; $j--) {
$lastIndex = "\0";
$lastIndex = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It read it should be null instead. This can change the result of the condition in 1218, where it would match black (if I understand it correctly).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True point. And chr(null) also doesn't print a warning instead of chr("\0").

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$sameNum = 0;
for ($i = 0; $i <= $width; $i++) {
$index = imagecolorat($im, $i, $j);
Expand Down