Skip to content

OC_Image.php needs fixes for PHP 8 object support #29466

@guystreeter

Description

@guystreeter

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Try to run occ face:backgroud_job

Expected behaviour

The command should complete successfully

Actual behaviour

Faces found: 0. Image will be skipped because of the following error: Error during image resize for every photo.

Server configuration

Latest Nextcloud docker image

The error occurs because in PHP 8, the imagecreate* functions return objects, when previously they returned resources. The functions in OC_Image.php use is_resource to check for success, and it fails because the returned value is an object.

Because all these image* functions return either a valid object or false (and they previously returned either a valid resource or false), is is sufficient to use !== false to check for success, for PHP 8 and for previous versions as well.

I have tested this change with success on my own installation..

Metadata

Metadata

Assignees

Labels

4. to releaseReady to be released and/or waiting for tests to finishbug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions