From 79e8b19dde6f1682058c683dd0af2e22a0a17bc6 Mon Sep 17 00:00:00 2001 From: Spomky Date: Wed, 24 Mar 2021 14:35:17 +0100 Subject: [PATCH] Fix PHP7.2 bug --- .github/workflows/functional-tests.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- phpstan.neon | 1 + src/Ecc/Curve.php | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 43585fa3..10a37856 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['7.3', '7.4', '8.0'] + php-versions: ['7.2', '7.3', '7.4', '8.0'] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index de95faeb..5e2094c9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: operating-system: [ ubuntu-latest ] - php-versions: ['7.3', '7.4', '8.0'] + php-versions: ['7.2', '7.3', '7.4', '8.0'] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: diff --git a/phpstan.neon b/phpstan.neon index 206f330f..56f8dde1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -18,6 +18,7 @@ parameters: - '#Array .* does not accept object\.#' - '#Invalid type object to throw\.#' - '#Strict comparison using === between .* and .* will always evaluate to false\.#' + - '#Binary operation "\^" between string and 1 results in an error\.#' includes: - vendor/phpstan/phpstan-strict-rules/rules.neon - vendor/phpstan/phpstan-phpunit/extension.neon diff --git a/src/Ecc/Curve.php b/src/Ecc/Curve.php index 7c361c03..1df9aee1 100644 --- a/src/Ecc/Curve.php +++ b/src/Ecc/Curve.php @@ -15,7 +15,6 @@ use Brick\Math\BigInteger; use function is_null; -use function ord; use RuntimeException; /** @@ -202,7 +201,7 @@ public function mul(Point $one, BigInteger $n): Point $n1 = str_pad(Math::baseConvert(Math::toString($n), 10, 2), $k, '0', STR_PAD_LEFT); for ($i = 0; $i < $k; ++$i) { - $j = ord($n1[$i]); + $j = $n1[$i]; Point::cswap($r[0], $r[1], $j ^ 1); $r[0] = $this->add($r[0], $r[1]); $r[1] = $this->getDouble($r[1]);