Skip to content

Commit 2e92ed3

Browse files
Fix backwards compatibility
1 parent b5406d9 commit 2e92ed3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib/BaseStub.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ class BaseStub
4343
*/
4444
public function __construct($hostname, $opts, $channel = null)
4545
{
46-
if (!ChannelCredentials::isDefaultRootsPemSet()) {
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()) {
4754
$ssl_roots = file_get_contents(
4855
dirname(__FILE__).'/../../etc/roots.pem'
4956
);

0 commit comments

Comments
 (0)