From a43dd38365faac5a5b85219c89a08cbe97e79c6f Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 27 Sep 2014 12:52:54 -0500 Subject: [PATCH] BigInteger: accomodate GMP change in PHP 5.6 --- phpseclib/Math/BigInteger.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php index ff6c69f6..ec229596 100644 --- a/phpseclib/Math/BigInteger.php +++ b/phpseclib/Math/BigInteger.php @@ -329,9 +329,12 @@ class Math_BigInteger switch ( MATH_BIGINTEGER_MODE ) { case MATH_BIGINTEGER_MODE_GMP: - if (is_resource($x) && get_resource_type($x) == 'GMP integer') { - $this->value = $x; - return; + switch (true) { + case is_resource($x) && get_resource_type($x) == 'GMP integer': + // PHP 5.6 switched GMP from using resources to objects + case is_object($x) && get_class($x) == 'GMP': + $this->value = $x; + return; } $this->value = gmp_init(0); break;