aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php
diff options
context:
space:
mode:
Diffstat (limited to 'src/php')
-rw-r--r--src/php/composer.json2
-rw-r--r--src/php/ext/grpc/server.c5
-rw-r--r--src/php/ext/grpc/version.h2
-rw-r--r--src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php52
4 files changed, 32 insertions, 29 deletions
diff --git a/src/php/composer.json b/src/php/composer.json
index 91913d73d2..f31423f8c0 100644
--- a/src/php/composer.json
+++ b/src/php/composer.json
@@ -2,7 +2,7 @@
"name": "grpc/grpc-dev",
"description": "gRPC library for PHP - for Developement use only",
"license": "Apache-2.0",
- "version": "1.15.0",
+ "version": "1.16.0",
"require": {
"php": ">=5.5.0",
"google/protobuf": "^v3.3.0"
diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c
index cb7b188b0e..8c7eaee203 100644
--- a/src/php/ext/grpc/server.c
+++ b/src/php/ext/grpc/server.c
@@ -75,7 +75,10 @@ PHP_METHOD(Server, __construct) {
if (args_array == NULL) {
server->wrapped = grpc_server_create(NULL, NULL);
} else {
- php_grpc_read_args_array(args_array, &args TSRMLS_CC);
+ if (php_grpc_read_args_array(args_array, &args TSRMLS_CC) == FAILURE) {
+ efree(args.args);
+ return;
+ }
server->wrapped = grpc_server_create(&args, NULL);
efree(args.args);
}
diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h
index 99dd9d68f0..469a48e782 100644
--- a/src/php/ext/grpc/version.h
+++ b/src/php/ext/grpc/version.h
@@ -20,6 +20,6 @@
#ifndef VERSION_H
#define VERSION_H
-#define PHP_GRPC_VERSION "1.15.0dev"
+#define PHP_GRPC_VERSION "1.16.0dev"
#endif /* VERSION_H */
diff --git a/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php b/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
index 2bb5c4bb85..5423368cdf 100644
--- a/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
+++ b/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
@@ -174,12 +174,12 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelSharedChannelClose()
{
// same underlying channel
- $this->channel1 = new Grpc\Channel('localhost:10010', [
+ $this->channel1 = new Grpc\Channel('localhost:10001', [
"grpc_target_persist_bound" => 2,
]);
- $this->channel2 = new Grpc\Channel('localhost:10010', []);
+ $this->channel2 = new Grpc\Channel('localhost:10001', []);
$this->server = new Grpc\Server([]);
- $this->port = $this->server->addHttp2Port('localhost:10010');
+ $this->port = $this->server->addHttp2Port('localhost:10001');
// channel2 can still be use
$state = $this->channel2->getConnectivityState();
@@ -216,7 +216,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTargetDefaultUpperBound()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', []);
+ $this->channel1 = new Grpc\Channel('localhost:10002', []);
$channel1_info = $this->channel1->getChannelInfo();
$this->assertEquals($channel1_info['target_upper_bound'], 1);
$this->assertEquals($channel1_info['target_current_size'], 1);
@@ -224,7 +224,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTargetUpperBoundZero()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', [
+ $this->channel1 = new Grpc\Channel('localhost:10002', [
"grpc_target_persist_bound" => 0,
]);
// channel1 will not be persisted.
@@ -237,7 +237,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTargetUpperBoundNotZero()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', [
+ $this->channel1 = new Grpc\Channel('localhost:10003', [
"grpc_target_persist_bound" => 3,
]);
$channel1_info = $this->channel1->getChannelInfo();
@@ -245,7 +245,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
$this->assertEquals($channel1_info['target_current_size'], 1);
// The upper bound should not be changed
- $this->channel2 = new Grpc\Channel('localhost:10011', []);
+ $this->channel2 = new Grpc\Channel('localhost:10003', []);
$channel2_info = $this->channel2->getChannelInfo();
$this->assertEquals($channel2_info['target_upper_bound'], 3);
$this->assertEquals($channel2_info['target_current_size'], 1);
@@ -253,14 +253,14 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
// The upper bound should not be changed
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel3 = new Grpc\Channel('localhost:10011',
+ $this->channel3 = new Grpc\Channel('localhost:10003',
['credentials' => $channel_credentials]);
$channel3_info = $this->channel3->getChannelInfo();
$this->assertEquals($channel3_info['target_upper_bound'], 3);
$this->assertEquals($channel3_info['target_current_size'], 2);
// The upper bound should not be changed
- $this->channel4 = new Grpc\Channel('localhost:10011', [
+ $this->channel4 = new Grpc\Channel('localhost:10003', [
"grpc_target_persist_bound" => 5,
]);
$channel4_info = $this->channel4->getChannelInfo();
@@ -270,7 +270,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelDefaultOutBound1()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', []);
+ $this->channel1 = new Grpc\Channel('localhost:10004', []);
// Make channel1 not IDLE.
$this->channel1->getConnectivityState(true);
$this->waitUntilNotIdle($this->channel1);
@@ -280,7 +280,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
// Since channel1 is CONNECTING, channel 2 will not be persisted
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10004',
['credentials' => $channel_credentials]);
$channel2_info = $this->channel2->getChannelInfo();
$this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -295,7 +295,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelDefaultOutBound2()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', []);
+ $this->channel1 = new Grpc\Channel('localhost:10005', []);
$channel1_info = $this->channel1->getChannelInfo();
$this->assertEquals(GRPC\CHANNEL_IDLE, $channel1_info['connectivity_status']);
@@ -303,7 +303,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
// gRPC channel. channel2 will not be persisted
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10005',
['credentials' => $channel_credentials]);
$channel2_info = $this->channel2->getChannelInfo();
$this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -318,7 +318,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelDefaultOutBound3()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', []);
+ $this->channel1 = new Grpc\Channel('localhost:10006', []);
$channel1_info = $this->channel1->getChannelInfo();
$this->assertEquals(GRPC\CHANNEL_IDLE, $channel1_info['connectivity_status']);
@@ -327,7 +327,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
// channel2 can be persisted.
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10006',
['credentials' => $channel_credentials]);
$channel2_info = $this->channel2->getChannelInfo();
$this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -342,7 +342,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTwoUpperBound()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', [
+ $this->channel1 = new Grpc\Channel('localhost:10007', [
"grpc_target_persist_bound" => 2,
]);
$channel1_info = $this->channel1->getChannelInfo();
@@ -351,7 +351,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
// Since channel1 is IDLE, channel 1 will be deleted
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10007',
['credentials' => $channel_credentials]);
$channel2_info = $this->channel2->getChannelInfo();
$this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -393,14 +393,14 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTwoUpperBoundOutBound2()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', [
+ $this->channel1 = new Grpc\Channel('localhost:10012', [
"grpc_target_persist_bound" => 2,
]);
$channel1_info = $this->channel1->getChannelInfo();
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10012',
['credentials' => $channel_credentials]);
$channel2_info = $this->channel2->getChannelInfo();
@@ -409,7 +409,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
$channel_credentials = Grpc\ChannelCredentials::createSsl("a", null,
null);
- $this->channel3 = new Grpc\Channel('localhost:10011',
+ $this->channel3 = new Grpc\Channel('localhost:10012',
['credentials' => $channel_credentials]);
$channel3_info = $this->channel3->getChannelInfo();
@@ -422,14 +422,14 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTwoUpperBoundOutBound3()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', [
+ $this->channel1 = new Grpc\Channel('localhost:10013', [
"grpc_target_persist_bound" => 2,
]);
$channel1_info = $this->channel1->getChannelInfo();
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10013',
['credentials' => $channel_credentials]);
$this->channel2->getConnectivityState(true);
$this->waitUntilNotIdle($this->channel2);
@@ -442,7 +442,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
$channel_credentials = Grpc\ChannelCredentials::createSsl("a", null,
null);
- $this->channel3 = new Grpc\Channel('localhost:10011',
+ $this->channel3 = new Grpc\Channel('localhost:10013',
['credentials' => $channel_credentials]);
$channel3_info = $this->channel3->getChannelInfo();
@@ -456,7 +456,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
public function testPersistentChannelTwoUpperBoundOutBound4()
{
- $this->channel1 = new Grpc\Channel('localhost:10011', [
+ $this->channel1 = new Grpc\Channel('localhost:10014', [
"grpc_target_persist_bound" => 2,
]);
$this->channel1->getConnectivityState(true);
@@ -466,7 +466,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
$channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
null);
- $this->channel2 = new Grpc\Channel('localhost:10011',
+ $this->channel2 = new Grpc\Channel('localhost:10014',
['credentials' => $channel_credentials]);
$this->channel2->getConnectivityState(true);
$this->waitUntilNotIdle($this->channel2);
@@ -475,7 +475,7 @@ class PersistentListTest extends PHPUnit_Framework_TestCase
$channel_credentials = Grpc\ChannelCredentials::createSsl("a", null,
null);
- $this->channel3 = new Grpc\Channel('localhost:10011',
+ $this->channel3 = new Grpc\Channel('localhost:10014',
['credentials' => $channel_credentials]);
$channel3_info = $this->channel3->getChannelInfo();