Skip to content

Commit

Permalink
Merge pull request #103 from remicollet/issue-php8
Browse files Browse the repository at this point in the history
fix for PHP 8
  • Loading branch information
khanamiryan authored Apr 20, 2021
2 parents 07fceef + 534564d commit 4676df0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions lib/GDLuminanceSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function GDLuminanceSource($gdImage, $width, $height)
$this->dataHeight = $height;
$this->left = 0;
$this->top = 0;
$this->$gdImage = $gdImage;
$this->gdImage = $gdImage;


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

for ($j = 0; $j < $height; $j++) {
for ($i = 0; $i < $width; $i++) {
$argb = imagecolorat($this->$gdImage, $i, $j);
$pixel = imagecolorsforindex($this->$gdImage, $argb);
$argb = imagecolorat($this->gdImage, $i, $j);
$pixel = imagecolorsforindex($this->gdImage, $argb);
$r = $pixel['red'];
$g = $pixel['green'];
$b = $pixel['blue'];
Expand Down
2 changes: 1 addition & 1 deletion lib/QrReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct($imgSource, $sourceType = QrReader::SOURCE_TYPE_FILE
$height = $im->getImageHeight();
$source = new IMagickLuminanceSource($im, $width, $height);
} else {
if (!is_resource($im)) {
if (!is_resource($im) && !is_object($im)) {
throw new \InvalidArgumentException('Invalid image source.');
}
$width = imagesx($im);
Expand Down

0 comments on commit 4676df0

Please sign in to comment.