From 7978f2fa81ca5d1bcded6938d358396e3ec37eea Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 30 Nov 2020 09:08:04 +0100 Subject: update to 1.0.4 add patch for PHP 8 from https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/103 switch to phpunit9 --- 103.patch | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 103.patch (limited to '103.patch') diff --git a/103.patch b/103.patch new file mode 100644 index 0000000..b7900d6 --- /dev/null +++ b/103.patch @@ -0,0 +1,61 @@ +From 534564dda8041e19884eb50b4694a7d5c2638abd Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 30 Nov 2020 09:01:24 +0100 +Subject: [PATCH] fix for PHP 8 + +--- + composer.json | 2 +- + lib/GDLuminanceSource.php | 6 +++--- + lib/QrReader.php | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/composer.json b/composer.json +index 9187ebd..ba76df8 100644 +--- a/composer.json ++++ b/composer.json +@@ -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": { +diff --git a/lib/GDLuminanceSource.php b/lib/GDLuminanceSource.php +index 526df82..f1f808c 100644 +--- a/lib/GDLuminanceSource.php ++++ b/lib/GDLuminanceSource.php +@@ -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 +@@ -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']; +diff --git a/lib/QrReader.php b/lib/QrReader.php +index 200f910..b7dd1ea 100644 +--- a/lib/QrReader.php ++++ b/lib/QrReader.php +@@ -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); -- cgit