1
0
Fork 0

Fix openssl_x509_parse() function namespace issue under PHP 5.3.3

pull/2745/head
Pádraic Brady 2014-02-23 15:28:07 +00:00
parent bdad4f2b0c
commit 2a552df315
1 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ class RemoteFilesystem
$this->options = $this->getTlsDefaults(); $this->options = $this->getTlsDefaults();
if (isset($options['ssl']['cafile']) if (isset($options['ssl']['cafile'])
&& (!is_readable($options['ssl']['cafile']) && (!is_readable($options['ssl']['cafile'])
|| !openssl_x509_parse(file_get_contents($options['ssl']['cafile'])))) { //check return value and test (it's subject to change) || !\openssl_x509_parse(file_get_contents($options['ssl']['cafile'])))) { //check return value and test (it's subject to change)
throw new TransportException('The configured cafile was not valid or could not be read.'); throw new TransportException('The configured cafile was not valid or could not be read.');
} }
} }
@ -486,7 +486,7 @@ class RemoteFilesystem
// If SSL_CERT_FILE env variable points to a valid certificate/bundle, use that. // If SSL_CERT_FILE env variable points to a valid certificate/bundle, use that.
// This mimics how OpenSSL uses the SSL_CERT_FILE env variable. // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
$envCertFile = getenv('SSL_CERT_FILE'); $envCertFile = getenv('SSL_CERT_FILE');
if ($envCertFile && is_readable($envCertFile) && openssl_x509_parse(file_get_contents($envCertFile))) { if ($envCertFile && is_readable($envCertFile) && \openssl_x509_parse(file_get_contents($envCertFile))) {
// Possibly throw exception instead of ignoring SSL_CERT_FILE if it's invalid? // Possibly throw exception instead of ignoring SSL_CERT_FILE if it's invalid?
return $envCertFile; return $envCertFile;
} }
@ -504,7 +504,7 @@ class RemoteFilesystem
static $found = false; static $found = false;
foreach ($caBundlePaths as $caBundle) { foreach ($caBundlePaths as $caBundle) {
if (is_readable($caBundle) && openssl_x509_parse(file_get_contents($caBundle))) { if (is_readable($caBundle) && \openssl_x509_parse(file_get_contents($caBundle))) {
$found = true; $found = true;
break; break;
} }