aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2018-05-23 18:14:34 -0700
committerGitHub <noreply@github.com>2018-05-23 18:14:34 -0700
commit7a23a2ea5e058d5b814a872c5797d45f0f55a2a6 (patch)
tree64e57461b56bfeb57127bc814849db45a55d51cc
parent6ae6e1baa2ef07d4abe81976a2577797598b2d31 (diff)
downloadprotobuf-7a23a2ea5e058d5b814a872c5797d45f0f55a2a6.tar.gz
protobuf-7a23a2ea5e058d5b814a872c5797d45f0f55a2a6.tar.bz2
protobuf-7a23a2ea5e058d5b814a872c5797d45f0f55a2a6.zip
Fix array constructor in c extension for compatibility (#4667)
In old generated code, the constructor of message doesn't provide a default null to parent's constructor. Previously, in c extesnion, this case was not handled.
-rw-r--r--php/ext/google/protobuf/message.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c
index 69012871..e28e42a1 100644
--- a/php/ext/google/protobuf/message.c
+++ b/php/ext/google/protobuf/message.c
@@ -387,9 +387,9 @@ void Message_construct(zval* msg, zval* array_wrapper) {
// object. Here, we manually modify it to our message in such a case.
PHP_METHOD(Message, __construct) {
// Init message with array
- zval* array_wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!", &array_wrapper,
- message_type) == FAILURE) {
+ zval* array_wrapper = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ "|a!", &array_wrapper) == FAILURE) {
return;
}