fix #19721 missing addref in channel::constructor()

pull/19737/head
Hannah Shi 6 years ago
parent 970ae3c112
commit 9841ed0763
  1. 1
      src/php/ext/grpc/channel.c
  2. 6
      src/php/tests/unit_tests/ChannelTest.php

@ -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"));

@ -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',

Loading…
Cancel
Save