Merge branch '3.5.0.1' into 3.5.x

pull/4026/head
Bo Yang 7 years ago
commit fc5818b2bb
  1. 2
      php/ext/google/protobuf/def.c
  2. 4
      php/ext/google/protobuf/message.c
  3. 38
      php/ext/google/protobuf/package.xml
  4. 2
      php/ext/google/protobuf/protobuf.h
  5. 1
      php/ext/google/protobuf/type_check.c
  6. 26
      php/tests/memory_leak_test.php

@ -249,9 +249,11 @@ PHP_METHOD(Descriptor, getField) {
MAKE_STD_ZVAL(field_hashtable_value);
ZVAL_OBJ(field_hashtable_value, field_descriptor_type->create_object(
field_descriptor_type TSRMLS_CC));
Z_DELREF_P(field_hashtable_value);
#else
field_hashtable_value =
field_descriptor_type->create_object(field_descriptor_type TSRMLS_CC);
--GC_REFCOUNT(field_hashtable_value);
#endif
FieldDescriptor *field_php =
UNBOX_HASHTABLE_VALUE(FieldDescriptor, field_hashtable_value);

@ -379,6 +379,7 @@ PHP_METHOD(Message, whichOneof) {
PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \
zval* value = message_get_property_internal(getThis(), &member TSRMLS_CC); \
PHP_PROTO_FAKE_SCOPE_END; \
zval_dtor(&member); \
PHP_PROTO_RETVAL_ZVAL(value); \
} \
PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \
@ -390,6 +391,7 @@ PHP_METHOD(Message, whichOneof) {
zval member; \
PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \
message_set_property_internal(getThis(), &member, value TSRMLS_CC); \
zval_dtor(&member); \
PHP_PROTO_RETVAL_ZVAL(getThis()); \
}
@ -402,6 +404,7 @@ PHP_METHOD(Message, whichOneof) {
message_get_oneof_property_internal(getThis(), &member, \
return_value TSRMLS_CC); \
PHP_PROTO_FAKE_SCOPE_END; \
zval_dtor(&member); \
} \
PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \
zval* value = NULL; \
@ -412,6 +415,7 @@ PHP_METHOD(Message, whichOneof) {
zval member; \
PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \
message_set_property_internal(getThis(), &member, value TSRMLS_CC); \
zval_dtor(&member); \
PHP_PROTO_RETVAL_ZVAL(getThis()); \
}

@ -10,11 +10,11 @@
<email>protobuf-opensource@google.com</email>
<active>yes</active>
</lead>
<date>2017-11-15</date>
<date>2017-12-11</date>
<time>11:02:07</time>
<version>
<release>3.5.0</release>
<api>3.5.0</api>
<release>3.5.1</release>
<api>3.5.1</api>
</version>
<stability>
<release>stable</release>
@ -181,6 +181,38 @@ GA release.
<time>11:02:07</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
GA release.
</notes>
</release>
<release>
<version>
<release>3.5.0.1</release>
<api>3.5.0.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2017-12-06</date>
<time>11:02:07</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
GA release.
</notes>
</release>
<release>
<version>
<release>3.5.1</release>
<api>3.5.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2017-12-11</date>
<time>11:02:07</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
GA release.
</notes>
</release>

@ -37,7 +37,7 @@
#include "upb.h"
#define PHP_PROTOBUF_EXTNAME "protobuf"
#define PHP_PROTOBUF_VERSION "3.5.0"
#define PHP_PROTOBUF_VERSION "3.5.1"
#define MAX_LENGTH_OF_INT64 20
#define SIZEOF_INT64 8

@ -532,6 +532,7 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
map_field_handlers->write_dimension(
CACHED_TO_ZVAL_PTR(map_field), &key,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC);
zval_dtor(&key);
}
RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1);

@ -50,7 +50,8 @@ $to->mergeFromString($data);
TestUtil::assertTestMessage($to);
$from->setRecursive($from);
// TODO(teboring): This causes following tests fail in php7.
# $from->setRecursive($from);
$arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class);
$arr[] = new TestMessage;
@ -106,15 +107,34 @@ $m->mergeFromString(hex2bin('F80601'));
assert('F80601', bin2hex($m->serializeToString()));
// Test create repeated field via array.
$str_arr = array();
$str_arr = array("abc");
$m = new TestMessage();
$m->setRepeatedString($str_arr);
// Test create map field via array.
$str_arr = array();
$str_arr = array("abc"=>"abc");
$m = new TestMessage();
$m->setMapStringString($str_arr);
// Test unset
$from = new TestMessage();
TestUtil::setTestMessage($from);
unset($from);
// Test wellknown
$from = new \Google\Protobuf\Timestamp();
$from->setSeconds(1);
assert(1, $from->getSeconds());
$from = new \Google\Protobuf\Value();
$from->setNumberValue(1);
assert(1, $from->getNumberValue());
// Test descriptor
$pool = \Google\Protobuf\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName("\Foo\TestMessage");
$field = $desc->getField(1);
# $from = new TestMessage();
# $to = new TestMessage();
# TestUtil::setTestMessage($from);

Loading…
Cancel
Save