aboutsummaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2018-05-23 18:14:34 -0700
committerPaul Yang <TeBoring@users.noreply.github.com>2018-05-24 13:39:41 -0700
commit00d32539c6aa0c4efe9577561a00f443edd9a417 (patch)
treef30d7aabf94de2de24d274b2d8080cc7ad4ff989 /php
parent6737954661ed26105dd87a4c78fe3f333c978961 (diff)
downloadprotobuf-00d32539c6aa0c4efe9577561a00f443edd9a417.tar.gz
protobuf-00d32539c6aa0c4efe9577561a00f443edd9a417.tar.bz2
protobuf-00d32539c6aa0c4efe9577561a00f443edd9a417.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.
Diffstat (limited to 'php')
-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;
}