Skip to content

Commit

Permalink
Use gmp operator overload instead of gmp_pow for certain PHP versions (
Browse files Browse the repository at this point in the history
…#215)

Use gmp operator overload instead of gmp_pow for certain PHP versions
  • Loading branch information
kelvinmo authored Dec 11, 2024
2 parents 4cd56a8 + 37ce733 commit 82006ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- 8.0
- 8.1
- 8.2
- 8.3
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions src/SimpleJWT/Util/BigNum.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ protected function _div($a, $b) {
function _pow($base, $exp) {
if (is_object($exp) && ($exp instanceof \GMP))
$exp = gmp_intval($exp);
/** @disregard P1006 */
if (version_compare(PHP_VERSION, '8.2.26', '==') || version_compare(PHP_VERSION, '8.3.14', '=='))
return ($base ** $exp);
return gmp_pow($base, $exp);
}

Expand Down

0 comments on commit 82006ee

Please sign in to comment.