add initializing start batch message buffer, fix PR#24914

pull/25245/head
root 4 years ago
parent 931ce5aea1
commit 45c736f48f
  1. 2
      src/php/ext/grpc/call.c
  2. 14
      src/php/tests/generated_code/AbstractGeneratedCodeTest.php

@ -294,7 +294,7 @@ PHP_METHOD(Call, startBatch) {
grpc_status_code status;
grpc_slice recv_status_details = grpc_empty_slice();
grpc_slice send_status_details = grpc_empty_slice();
grpc_byte_buffer *message;
grpc_byte_buffer *message = NULL;
int cancelled;
grpc_call_error error;

@ -289,6 +289,20 @@ abstract class AbstractGeneratedCodeTest extends \PHPUnit\Framework\TestCase
$status = $call->getStatus();
$this->assertSame(\Grpc\STATUS_OK, $status->code);
}
public function testReuseCall()
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage("start_batch was called incorrectly");
$div_arg = new Math\DivArgs();
$div_arg->setDividend(7);
$div_arg->setDivisor(4);
$call = self::$client->Div($div_arg, [], ['timeout' => 1000000]);
list($response, $status) = $call->wait();
$this->assertSame(\Grpc\STATUS_OK, $status->code);
list($response, $status) = $call->wait();
}
}
class DummyInvalidClient extends \Grpc\BaseStub

Loading…
Cancel
Save