Skip to content

Commit 4676df0

Browse files
authored
Merge pull request #103 from remicollet/issue-php8
fix for PHP 8
2 parents 07fceef + 534564d commit 4676df0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"php": ">=5.6"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^9.0"
24+
"phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

lib/GDLuminanceSource.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function GDLuminanceSource($gdImage, $width, $height)
5252
$this->dataHeight = $height;
5353
$this->left = 0;
5454
$this->top = 0;
55-
$this->$gdImage = $gdImage;
55+
$this->gdImage = $gdImage;
5656

5757

5858
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
@@ -65,8 +65,8 @@ public function GDLuminanceSource($gdImage, $width, $height)
6565

6666
for ($j = 0; $j < $height; $j++) {
6767
for ($i = 0; $i < $width; $i++) {
68-
$argb = imagecolorat($this->$gdImage, $i, $j);
69-
$pixel = imagecolorsforindex($this->$gdImage, $argb);
68+
$argb = imagecolorat($this->gdImage, $i, $j);
69+
$pixel = imagecolorsforindex($this->gdImage, $argb);
7070
$r = $pixel['red'];
7171
$g = $pixel['green'];
7272
$b = $pixel['blue'];

lib/QrReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct($imgSource, $sourceType = QrReader::SOURCE_TYPE_FILE
6262
$height = $im->getImageHeight();
6363
$source = new IMagickLuminanceSource($im, $width, $height);
6464
} else {
65-
if (!is_resource($im)) {
65+
if (!is_resource($im) && !is_object($im)) {
6666
throw new \InvalidArgumentException('Invalid image source.');
6767
}
6868
$width = imagesx($im);

0 commit comments

Comments
 (0)