Merge pull request #19737 from HannahShiSFB/channelConstructorAddref

PHP: Fix missing addref in channel::constructor()
pull/19622/head
Stanley Cheung 5 years ago committed by GitHub
commit 3ef9f59d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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