Skip to content

Commit

Permalink
Fix compatibility with PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Sep 13, 2020
1 parent 3db069b commit e68b92b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ matrix:
php: '7.4'
env:
- IMAGINE_DRIVER: all
-
name: Test with PHP 8.0 (all drivers)
php: '8.0snapshot'
env:
- IMAGINE_DRIVER: all
-
name: Test with PHP nightly (all drivers)
php: nightly
Expand Down
4 changes: 2 additions & 2 deletions src/Gd/Imagine.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function open($path)

$resource = $this->createImageFromString($data);

if (!\is_resource($resource)) {
if (!$resource instanceof \GdImage && !\is_resource($resource)) {
throw new RuntimeException(sprintf('Unable to open image %s', $path));
}

Expand Down Expand Up @@ -210,7 +210,7 @@ private function doLoad($string, MetadataBag $metadata)
{
$resource = $this->createImageFromString($string);

if (!\is_resource($resource)) {
if (!$resource instanceof \GdImage && !\is_resource($resource)) {
throw new RuntimeException('An image could not be created from the given input');
}

Expand Down

0 comments on commit e68b92b

Please sign in to comment.