PHP 8 fatal error
aheinze opened this issue · 2 comments
aheinze commented
Starting with PHP 8.0, get_resource_type with a GD image argument, will throw a Fatal Error.
The __destruct
method causes this error:
PHP Fatal error: Uncaught TypeError: get_resource_type(): Argument #1 ($resource) must be of type resource, GdImage given.
Fix:
public function __destruct() {
if ($this->image !== null && ((gettype($this->image) == "object" && get_class($this->image) == "GdImage") || get_resource_type($this->image) === 'gd')) {
imagedestroy($this->image);
}
}
claviska commented
Thanks. Are you interested in making this a PR?
aheinze commented
Sorry, seems to be fixed in the latest release 👍