diff options
-rw-r--r-- | 103.patch | 61 | ||||
-rw-r--r-- | composer.json | 4 | ||||
-rw-r--r-- | php-khanamiryan-qrcode-detector-decoder.spec | 33 |
3 files changed, 86 insertions, 12 deletions
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 <remi@remirepo.net> +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); diff --git a/composer.json b/composer.json index 4e75736..9187ebd 100644 --- a/composer.json +++ b/composer.json @@ -18,10 +18,10 @@ } ], "require": { - "php": "^5.6|^7.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { diff --git a/php-khanamiryan-qrcode-detector-decoder.spec b/php-khanamiryan-qrcode-detector-decoder.spec index 9752f5a..9f4aa02 100644 --- a/php-khanamiryan-qrcode-detector-decoder.spec +++ b/php-khanamiryan-qrcode-detector-decoder.spec @@ -6,7 +6,7 @@ # # Please, preserve the changelog entries # -%global gh_commit 89b57f2d9939dd57394b83f6ccbd3e1a74659e34 +%global gh_commit 07fceefb79d895e858e52921afb9c1433d2f3d5e %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner khanamiryan %global gh_project php-qrcode-detector-decoder @@ -20,7 +20,7 @@ %global with_tests 0%{!?_without_tests:1} Name: php-%{pk_vendor}-%{pk_project} -Version: 1.0.3 +Version: 1.0.4 Release: 1%{?dist} Summary: QR code decoder / reader @@ -32,6 +32,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit # From https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/80 Patch0: https://patch-diff.githubusercontent.com/raw/khanamiryan/php-qrcode-detector-decoder/pull/80.patch +# From https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/103 +Patch1: https://patch-diff.githubusercontent.com/raw/khanamiryan/php-qrcode-detector-decoder/pull/103.patch BuildArch: noarch %if %{with_tests} @@ -44,14 +46,18 @@ BuildRequires: php-iconv BuildRequires: php-mbstring BuildRequires: php-spl # From composer.json, "require-dev": { -# "phpunit/phpunit": "^5.7" -BuildRequires: php-composer(phpunit/phpunit) +# "phpunit/phpunit": "^9.0" +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 +%global phpunit %{_bindir}/phpunit9 +%else +%global phpunit %{_bindir}/phpunit8 +%endif # Required by autoloader %endif BuildRequires: php-fedora-autoloader-devel # From composer.json, "require": { -# "php": "^5.6|^7.0" +# "php": ">=5.6" Requires: php(language) >= 5.6 # From phpcompatinfo report for version 1 Requires: php-reflection @@ -83,6 +89,7 @@ Autoloader: %{php_home}/%{ns_project}/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p1 +%patch1 -p1 %build @@ -107,16 +114,16 @@ cp -pr lib %{buildroot}%{php_home}/%{ns_project} %check %if %{with_tests} mkdir vendor -cat << 'EOF' | tee tests/bootstrap.php +cat << 'EOF' | tee vendor/autoload.php <?php require '%{buildroot}%{php_home}/%{ns_project}/autoload.php'; EOF ret=0 -# TODO php 8: Tests: 1, Assertions: 0, Errors: 1. -for cmd in php php56 php70 php71 php72 php73 php74; do - if which $cmd; then - $cmd %{_bindir}/phpunit --verbose || ret=1 +for cmdarg in "php %{phpunit}" "php72 %{_bindir}/phpunit8" php73 php74 php80; do + if which $cmdarg; then + set $cmdarg + $1 ${2:-%{_bindir}/phpunit9} $filter --verbose || ret=1 fi done exit $ret @@ -135,6 +142,12 @@ exit $ret %changelog +* Mon Nov 30 2020 Remi Collet <remi@remirepo.net> - 1.0.4-1 +- update to 1.0.4 +- add patch for PHP 8 from + https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/103 +- switch to phpunit9 + * Mon Apr 20 2020 Remi Collet <remi@remirepo.net> - 1.0.3-1 - update to 1.0.3 |