File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,11 @@ public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
7171
7272 // If SSL_CERT_FILE env variable points to a valid certificate/bundle, use that.
7373 // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
74- $ caBundlePaths [] = getenv ('SSL_CERT_FILE ' );
74+ $ caBundlePaths [] = self :: getEnvVariable ('SSL_CERT_FILE ' );
7575
7676 // If SSL_CERT_DIR env variable points to a valid certificate/bundle, use that.
7777 // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
78- $ caBundlePaths [] = getenv ('SSL_CERT_DIR ' );
78+ $ caBundlePaths [] = self :: getEnvVariable ('SSL_CERT_DIR ' );
7979
8080 $ caBundlePaths [] = ini_get ('openssl.cafile ' );
8181 $ caBundlePaths [] = ini_get ('openssl.capath ' );
@@ -299,6 +299,19 @@ public static function reset()
299299 self ::$ useOpensslParse = null ;
300300 }
301301
302+ private static function getEnvVariable ($ name )
303+ {
304+ if (isset ($ _SERVER [$ name ])) {
305+ return (string ) $ _SERVER [$ name ];
306+ }
307+
308+ if (PHP_SAPI === 'cli ' && ($ value = getenv ($ name )) !== false && $ value !== null ) {
309+ return (string ) $ value ;
310+ }
311+
312+ return false ;
313+ }
314+
302315 private static function caFileUsable ($ certFile , LoggerInterface $ logger = null )
303316 {
304317 return $ certFile && @is_file ($ certFile ) && @is_readable ($ certFile ) && static ::validateCaFile ($ certFile , $ logger );
You can’t perform that action at this time.
0 commit comments