Skip to content

Commit

Permalink
Merge pull request #47 from exussum12/changeOrder
Browse files Browse the repository at this point in the history
Change order and add glob to ignore empty dirs
  • Loading branch information
Seldaek committed Aug 1, 2019
2 parents ca25387 + 4a6fa5a commit ec2e24d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CaBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
// This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
$caBundlePaths[] = getenv('SSL_CERT_DIR');

$caBundlePaths[] = ini_get('openssl.cafile');
$caBundlePaths[] = ini_get('openssl.capath');

if (function_exists('openssl_get_cert_locations')) {
$locations = openssl_get_cert_locations();
$caBundlePaths[] = $locations['default_cert_file'];
$caBundlePaths[] = $locations['default_cert_dir'];
}

$caBundlePaths[] = ini_get('openssl.cafile');
$caBundlePaths[] = ini_get('openssl.capath');

$otherLocations = array(
'/etc/pki/tls/certs/ca-bundle.crt', // Fedora, RHEL, CentOS (ca-certificates package)
'/etc/ssl/certs/ca-certificates.crt', // Debian, Ubuntu, Gentoo, Arch Linux (ca-certificates package)
Expand Down Expand Up @@ -311,6 +311,6 @@ private static function caFileUsable($certFile, LoggerInterface $logger = null)

private static function caDirUsable($certDir)
{
return $certDir && @is_dir($certDir) && @is_readable($certDir);
return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
}
}

0 comments on commit ec2e24d

Please sign in to comment.