From 2e7771d7a05a9416c530332f0ebd2c0522c4e6e6 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Tue, 2 Mar 2021 22:49:24 +0300 Subject: [PATCH] read_property() handler is not supposed to return NULL NULL is never expected as a result of read_property() handler, it should return &EG(uninitialized_zval) if there is no such property in the object --- php/ext/google/protobuf/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 7f27670320dc0..0f1f4c964e6bd 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -334,7 +334,7 @@ static zval *Message_read_property(PROTO_VAL *obj, PROTO_STR *member, Message* intern = PROTO_VAL_P(obj); const upb_fielddef *f = get_field(intern, member); - if (!f) return NULL; + if (!f) return &EG(uninitialized_zval); Message_get(intern, f, rv); return rv; }