Эх сурвалжийг харах

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
Antony Dovgal 4 жил өмнө
parent
commit
aa41d9005b

+ 1 - 1
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;
 }