Merge branch '1.0' into identifier-update-1.0

This commit is contained in:
terrafrost 2015-12-14 11:07:42 -06:00
commit 786cecf309
5 changed files with 47 additions and 7 deletions

View File

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

View File

@ -677,7 +677,7 @@ class File_ASN1
}
// Fail mapping if all input items have not been consumed.
return $i < $n? null: $map;
return $i < $n ? null: $map;
// the main diff between sets and sequences is the encapsulation of the foreach in another for loop
case FILE_ASN1_TYPE_SET:

View File

@ -811,6 +811,39 @@ class Math_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

@ -358,4 +358,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
git clone https://github.com/zenovich/runkit.git
install_php_extension 'runkit'