Merge branch '2.0'

This commit is contained in:
terrafrost 2015-12-14 11:02:14 -06:00
commit b86497d298
5 changed files with 47 additions and 7 deletions

View File

@ -8,6 +8,7 @@ php:
- 5.5
- 5.6
- 7.0
- hhvm
env:
global:

View File

@ -803,6 +803,39 @@ class BigInteger
}
}
/**
* __debugInfo() magic method
*
* Will be called, automatically, when print_r() or var_dump() are called
*
* @access public
*/
function __debugInfo()
{
$opts = array();
switch (MATH_BIGINTEGER_MODE) {
case MATH_BIGINTEGER_MODE_GMP:
$engine = 'gmp';
break;
case MATH_BIGINTEGER_MODE_BCMATH:
$engine = 'bcmath';
break;
case MATH_BIGINTEGER_MODE_INTERNAL:
$engine = 'internal';
$opts[] = PHP_INT_SIZE == 8 ? '64-bit' : '32-bit';
}
if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_GMP && defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
$opts[] = 'OpenSSL';
}
if (!empty($opts)) {
$engine.= ' (' . implode($opts, ', ') . ')';
}
return array(
'value' => '0x' . $this->toHex(true),
'engine' => $engine
);
}
/**
* Adds two BigIntegers.
*

View File

@ -355,4 +355,15 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
'Failed asserting that Alice and Bob share the same BigInteger.'
);
}
/**
* @requires PHP 5.6
*/
public function testDebugInfo()
{
$num = new Math_BigInteger(50);
$str = print_r($num, true);
$this->assertContains('[value] => 0x32', $str);
return $str;
}
}

View File

@ -21,10 +21,5 @@ function install_php_extension
}
# runkit
if [ "$TRAVIS_PHP_VERSION" == "5.6" ]
then
git clone https://github.com/adrianguenter/runkit.git
else
git clone https://github.com/zenovich/runkit.git
fi
install_php_extension 'runkit'