diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 5286341e..74ca5ff4 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -2418,7 +2418,7 @@ class X509 $altName = []; if (isset($subject->domains) && count($subject->domains) > 1) { - $altName = array_map(['X509', '_dnsName'], $subject->domains); + $altName = array_map(['\phpseclib\File\X509', 'dnsName'], $subject->domains); } if (isset($subject->ipAddresses) && count($subject->ipAddresses)) { diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index 5e64fdae..8d72b902 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -453,4 +453,22 @@ Mj93S runkit_constant_remove('FILE_X509_IGNORE_TYPE'); } + + // fixed by #1104 + public function testMultipleDomainNames() + { + extract(RSA::createKey(512)); + + $subject = new X509(); + $subject->setDomain('example.com', 'example.net'); + + $subject->setPublicKey($publickey); + + $issuer = new X509(); + $issuer->setPrivateKey($privatekey); + $issuer->setDN($subject->getDN()); + + $x509 = new X509(); + $x509->sign($issuer, $subject); + } }