diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index 860d38be34a..8551ba2c196 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -330,6 +330,7 @@ PHP_METHOD(Channel, __construct) { 1 TSRMLS_CC); return; } else { + Z_ADDREF(*creds_obj); creds = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel_credentials, creds_obj); php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials")); diff --git a/src/php/tests/unit_tests/ChannelTest.php b/src/php/tests/unit_tests/ChannelTest.php index 583c618d32a..58f96a740b6 100644 --- a/src/php/tests/unit_tests/ChannelTest.php +++ b/src/php/tests/unit_tests/ChannelTest.php @@ -37,6 +37,12 @@ class ChannelTest extends PHPUnit_Framework_TestCase $this->assertSame('Grpc\Channel', get_class($this->channel)); } + public function testConstructorCreateSsl() + { + new Grpc\Channel('localhost:50033', + ['credentials' => \Grpc\ChannelCredentials::createSsl()]); + } + public function testGetConnectivityState() { $this->channel = new Grpc\Channel('localhost:50001',