Skip to content

Commit

Permalink
Make assertEquals pass for message (#4947)
Browse files Browse the repository at this point in the history
This change only makes assertEquals pass for message in c extension. However, it actually does nothing.
This is the same behavior before 3.6.0 release.
  • Loading branch information
TeBoring authored Jul 20, 2018
1 parent d85ffdc commit fc90fd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 1 addition & 7 deletions php/ext/google/protobuf/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,7 @@ static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type,
}

static HashTable* message_get_properties(zval* object TSRMLS_DC) {
// User cannot get property directly (e.g., $a = $m->a)
zend_error(E_USER_ERROR, "Cannot access private properties.");
#if PHP_MAJOR_VERSION < 7
return zend_std_get_properties(object TSRMLS_CC);
#else
return zend_std_get_properties(object);
#endif
return NULL;
}

static HashTable* message_get_gc(zval* object, CACHED_VALUE** table,
Expand Down
13 changes: 13 additions & 0 deletions php/tests/generated_class_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1342,4 +1342,17 @@ public function testArrayConstructor()

TestUtil::assertTestMessage($m);
}

#########################################################
# Test message equals.
#########################################################

public function testMessageEquals()
{
$m = new TestMessage();
TestUtil::setTestMessage($m);
$n = new TestMessage();
TestUtil::setTestMessage($n);
$this->assertEquals($m, $n);
}
}

0 comments on commit fc90fd6

Please sign in to comment.