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
1 parent 80b9558 commit a27dcfe
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 @@ -14,6 +14,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 a27dcfe

Please sign in to comment.