Created
August 2, 2023 22:54
-
-
Save rlerdorf/ec8d81236ac56f7e48d12f8827c25d52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c | |
index 1abc4a3faf..7bc711be67 100644 | |
--- a/src/php/ext/grpc/call.c | |
+++ b/src/php/ext/grpc/call.c | |
@@ -451,7 +451,8 @@ PHP_METHOD(Call, startBatch) { | |
op_num++; | |
PHP_GRPC_HASH_FOREACH_END() | |
- error = grpc_call_start_batch(call->wrapped, ops, op_num, call->wrapped, | |
+ grpc_call *wrapped = call->wrapped; | |
+ error = grpc_call_start_batch(wrapped, ops, op_num, wrapped, | |
NULL); | |
if (error != GRPC_CALL_OK) { | |
zend_throw_exception(spl_ce_LogicException, | |
@@ -459,7 +460,7 @@ PHP_METHOD(Call, startBatch) { | |
(long)error TSRMLS_CC); | |
goto cleanup; | |
} | |
- grpc_completion_queue_pluck(completion_queue, call->wrapped, | |
+ grpc_completion_queue_pluck(completion_queue, wrapped, | |
gpr_inf_future(GPR_CLOCK_REALTIME), NULL); | |
zval *recv_md; | |
for (int i = 0; i < op_num; i++) { | |
@@ -624,5 +625,10 @@ void grpc_init_call(TSRMLS_D) { | |
INIT_CLASS_ENTRY(ce, "Grpc\\Call", call_methods); | |
ce.create_object = create_wrapped_grpc_call; | |
grpc_ce_call = zend_register_internal_class(&ce TSRMLS_CC); | |
+ zval property_channel_default_value; | |
+ ZVAL_NULL(&property_channel_default_value); | |
+ zend_string *property_channel_name = zend_string_init("channel", sizeof("channel") - 1, 1); | |
+ zend_declare_property_ex(grpc_ce_call, property_channel_name, &property_channel_default_value, ZEND_ACC_PROTECTED, NULL); | |
+ zend_string_release(property_channel_name); | |
PHP_GRPC_INIT_HANDLER(wrapped_grpc_call, call_ce_handlers); | |
} | |
diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c | |
index b308e3b566..8cac73ffd7 100644 | |
--- a/src/php/ext/grpc/channel.c | |
+++ b/src/php/ext/grpc/channel.c | |
@@ -241,11 +241,12 @@ void create_channel( | |
grpc_channel_args args, | |
wrapped_grpc_channel_credentials *creds) { | |
if (creds == NULL) { | |
- channel->wrapper->wrapped = grpc_insecure_channel_create(target, &args, | |
- NULL); | |
+ grpc_channel_credentials* insecure_creds = grpc_insecure_credentials_create(); | |
+ channel->wrapper->wrapped = grpc_channel_create(target, insecure_creds, &args); | |
+ grpc_channel_credentials_release(insecure_creds); | |
} else { | |
channel->wrapper->wrapped = | |
- grpc_secure_channel_create(creds->wrapped, target, &args, NULL); | |
+ grpc_channel_create(target, creds->wrapped, &args); | |
} | |
// There is an Grpc\Channel object refer to it. | |
php_grpc_channel_ref(channel->wrapper); | |
diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c | |
index 62033ec990..8a0aa075fd 100644 | |
--- a/src/php/ext/grpc/php_grpc.c | |
+++ b/src/php/ext/grpc/php_grpc.c | |
@@ -28,6 +28,7 @@ | |
#include "server_credentials.h" | |
#include "completion_queue.h" | |
#include <inttypes.h> | |
+#include <grpc/grpc_security.h> | |
#include <grpc/support/alloc.h> | |
#include <grpc/support/log.h> | |
#include <grpc/support/string_util.h> | |
@@ -110,11 +111,12 @@ void create_new_channel( | |
grpc_channel_args args, | |
wrapped_grpc_channel_credentials *creds) { | |
if (creds == NULL) { | |
- channel->wrapper->wrapped = grpc_insecure_channel_create(target, &args, | |
- NULL); | |
+ grpc_channel_credentials *insecure_creds = grpc_insecure_credentials_create(); | |
+ channel->wrapper->wrapped = grpc_channel_create(target, insecure_creds, &args); | |
+ grpc_channel_credentials_release(insecure_creds); | |
} else { | |
channel->wrapper->wrapped = | |
- grpc_secure_channel_create(creds->wrapped, target, &args, NULL); | |
+ grpc_channel_create(target, creds->wrapped, &args); | |
} | |
} | |
diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c | |
index 7f3c3b8e3b..2001760e34 100644 | |
--- a/src/php/ext/grpc/server.c | |
+++ b/src/php/ext/grpc/server.c | |
@@ -164,7 +164,10 @@ PHP_METHOD(Server, addHttp2Port) { | |
"add_http2_port expects a string", 1 TSRMLS_CC); | |
return; | |
} | |
- RETURN_LONG(grpc_server_add_insecure_http2_port(server->wrapped, addr)); | |
+ grpc_server_credentials *creds = grpc_insecure_server_credentials_create(); | |
+ int result = grpc_server_add_http2_port(server->wrapped, addr, creds); | |
+ grpc_server_credentials_release(creds); | |
+ RETURN_LONG(result); | |
} | |
/** | |
@@ -191,7 +194,7 @@ PHP_METHOD(Server, addSecureHttp2Port) { | |
} | |
wrapped_grpc_server_credentials *creds = | |
PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_server_credentials, creds_obj); | |
- RETURN_LONG(grpc_server_add_secure_http2_port(server->wrapped, addr, | |
+ RETURN_LONG(grpc_server_add_http2_port(server->wrapped, addr, | |
creds->wrapped)); | |
} | |
diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h | |
index 82d6f66c61..c864ee0292 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.43.0" | |
+#define PHP_GRPC_VERSION "1.56.0" | |
#endif /* VERSION_H */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment