From 7fbf089e329acf06cb861b60845813ae5318254d Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Thu, 8 Nov 2012 12:45:17 +0100 Subject: [PATCH] X509: Do not use memory-wasting create_function() --- phpseclib/File/X509.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 61b247a4..21a6cb6a 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -2805,8 +2805,7 @@ class File_X509 { if (isset($subject->domains) && count($subject->domains) > 1) { $this->setExtension('id-ce-subjectAltName', - array_map(create_function('$domain', - 'return array("dNSName" => $domain);'), $subject->domains)); + array_map(array('File_X509', '_dnsName'), $subject->domains)); } if ($this->caFlag) { @@ -3499,6 +3498,18 @@ class File_X509 { $this->setDNProp('id-at-commonName', $this->domains[0]); } + /** + * Helper function to build domain array + * + * @access private + * @param String $domain + * @return Array + */ + function _dnsName($domain) + { + return array('dNSName' => $domain); + } + /** * Get the index of a revoked certificate. *