Merge pull request #482 from terrafrost/gmp-56

BigInteger: accommodate GMP change in PHP 5.6

* terrafrost/gmp-56:
  BigInteger: accomodate GMP change in PHP 5.6
This commit is contained in:
Andreas Fischer 2014-09-27 22:57:49 +02:00
commit b6b0b2dec8

View File

@ -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;