Skip to content

Commit

Permalink
Merge branch '1.0' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Nov 29, 2024
2 parents ca7ae97 + 8de7a89 commit 702bd33
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions phpseclib/Math/BigInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,17 @@ class BigInteger
function __construct($x = 0, $base = 10)
{
if (!defined('MATH_BIGINTEGER_MODE')) {

// https://github.com/php/php-src/commit/e0a0e216a909dc4ee4ea7c113a5f41d49525f02e broke GMP
// https://github.com/php/php-src/commit/424ba0f2ff9677d16b4e339e90885bd4bc49fcf1 fixed it
// see https://github.com/php/php-src/issues/16870 for more info
if (version_compare(PHP_VERSION, '8.2.26', '<')) {
$gmpOK = true;
} else {
$gmpOK = !in_array(PHP_VERSION_ID, array(80226, 80314, 80400, 80401));
}
switch (true) {
// PHP 8.4.0 and 8.4.1 don't work with GMP per https://github.com/php/php-src/issues/16870
case extension_loaded('gmp') && !(version_compare(PHP_VERSION, '8.4.0', '>=') && version_compare(PHP_VERSION, '8.4.1', '<=')):
case extension_loaded('gmp') && $gmpOK:
define('MATH_BIGINTEGER_MODE', self::MODE_GMP);
break;
case extension_loaded('bcmath'):
Expand Down

0 comments on commit 702bd33

Please sign in to comment.