Skip to content

Commit 677282d

Browse files
Merge pull request #20 from stanley-cheung/fix-roots-pem
Fix logic setting default roots pem
2 parents 6b22409 + a3dbf29 commit 677282d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/lib/BaseStub.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,8 @@ class BaseStub
4343
*/
4444
public function __construct($hostname, $opts, $channel = null)
4545
{
46-
if (!method_exists('ChannelCredentials', 'isDefaultRootsPemSet')) {
47-
// for backwards compatibility
48-
// isDefaultRootsPemSet() may not be defined if the pecl extension
49-
// is not upgraded
50-
$ssl_roots = file_get_contents(
51-
dirname(__FILE__).'/../../etc/roots.pem'
52-
);
53-
} elseif (!ChannelCredentials::isDefaultRootsPemSet()) {
46+
if (!method_exists('ChannelCredentials', 'isDefaultRootsPemSet') ||
47+
!ChannelCredentials::isDefaultRootsPemSet()) {
5448
$ssl_roots = file_get_contents(
5549
dirname(__FILE__).'/../../etc/roots.pem'
5650
);

0 commit comments

Comments
 (0)