Merge pull request #336 from terrafrost/asn1-int

ASN1: make File_ASN1 accept int primitives and not just Math_BigInteger ...

* terrafrost/asn1-int:
  ASN1: let strings in as well
  ASN1: make File_ASN1 accept int primitives and not just Math_BigInteger objects when an integer is expected
This commit is contained in:
Andreas Fischer 2014-05-06 00:41:56 +02:00
commit 755d2106cb

View File

@ -950,6 +950,9 @@ class File_ASN1
case FILE_ASN1_TYPE_INTEGER:
case FILE_ASN1_TYPE_ENUMERATED:
if (!isset($mapping['mapping'])) {
if (is_numeric($source)) {
$source = new Math_BigInteger($source);
}
$value = $source->toBytes(true);
} else {
$value = array_search($source, $mapping['mapping']);