Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion php/ext/google/protobuf/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ static const upb_FieldDef* get_field(Message* msg, zend_string* member) {
m, ZSTR_VAL(member), ZSTR_LEN(member));

if (!f) {
zend_throw_exception_ex(NULL, 0, "No such property %s.",
zend_throw_exception_ex(NULL, 0, "No such property %s on %s.",
ZSTR_VAL(member),
ZSTR_VAL(msg->desc->class_entry->name));
}

Expand Down
8 changes: 8 additions & 0 deletions php/tests/GeneratedClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public function testSetterGetter()
$this->assertSame(1, $m->getOptionalInt32());
}

public function testUnknownPropertyErrorIncludesPropertyAndClass()
{
$m = new TestMessage();
$this->expectException(Exception::class);
$this->expectExceptionMessage('No such property does_not_exist on Foo\\TestMessage');
$m->does_not_exist;
}

#########################################################
# Test int32 field.
#########################################################
Expand Down
Loading