Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update class_image.php for PHP8 #358

Merged
merged 2 commits into from
Jan 8, 2023
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions kcfinder/lib/class_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ final protected function buildImage($image) {
$img = $image->image;

} elseif (is_array($image)) {
list($key, $width) = each($image);
list($key, $height) = each($image);
$width = $image[0];
$height = $image[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically this would fail if somebody did something like $gd = new image_gd(['w' => 200, 'h' => 200]);. I don't see it used that way anywhere, but it might be safer to use

$width = array_shift($image);
$height = array_shift($image);

Copy link
Contributor Author

@Michael-Labriola Michael-Labriola Jan 8, 2023

Choose a reason for hiding this comment

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

That looks good to me. I updated the pull request.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great. I see this is your first contribution. Thanks for this. For release notes credit can do you do another PR to add yourself to this file: https://github.com/civicrm/civicrm-core/blob/master/contributor-key.yml

Copy link
Contributor

Choose a reason for hiding this comment

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

jenkins add to whitelist

$img = $this->getBlankImage($width, $height);

} else
Expand Down Expand Up @@ -240,4 +240,4 @@ abstract protected function getImage($image, &$width, &$height);

}

?>
?>