diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-08-04 16:35:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-04 16:35:49 -0700 |
commit | 49b44bff2b6257a119f9c6a342d6151c736586b8 (patch) | |
tree | 75fbf8e5e5b9645c1108b321cd803b697fda0b34 /php/ext/google/protobuf/protobuf.h | |
parent | 21b0e5587c01948927ede9be789671ff116b7ad4 (diff) | |
download | protobuf-49b44bff2b6257a119f9c6a342d6151c736586b8.tar.gz |
Fix the bug in php c extension that setting one field can change anotherĀ field's value. (#3455)
* Fix the bug in php c extension that setting one field can change another
field's value.
The reason is that previously, in c extension, it was assumed that the
order that fields were declared in php is the same as the order of
fields in upb. This is not true. Now, for every field in upb, we will
look up the actual property that is corresponding to the upb field.
* Cleanup pull request
* Fix indentation
* Port to php5
* Port with php7.1
* Port to zts
Diffstat (limited to 'php/ext/google/protobuf/protobuf.h')
-rw-r--r-- | php/ext/google/protobuf/protobuf.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 44a4155f1..f9e9d2298 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -151,7 +151,7 @@ #define PHP_PROTO_GLOBAL_UNINITIALIZED_ZVAL EG(uninitialized_zval_ptr) -#define OBJ_PROP(PROPERTIES, OFFSET) (PROPERTIES)->properties_table[OFFSET] +#define OBJ_PROP(OBJECT, OFFSET) &((OBJECT)->properties_table[OFFSET]) #define php_proto_zval_ptr_dtor(zval_ptr) \ zval_ptr_dtor(&(zval_ptr)) @@ -644,7 +644,7 @@ PHP_PROTO_WRAP_OBJECT_END MessageLayout* create_layout(const upb_msgdef* msgdef); void layout_init(MessageLayout* layout, void* storage, - CACHED_VALUE* properties_table PHP_PROTO_TSRMLS_DC); + zend_object* object PHP_PROTO_TSRMLS_DC); zval* layout_get(MessageLayout* layout, const void* storage, const upb_fielddef* field, CACHED_VALUE* cache TSRMLS_DC); void layout_set(MessageLayout* layout, MessageHeader* header, |