Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
Patch Available
Description
Given a struct definition with an optional struct field, e.g.
struct Foo { 1: Bar bar, }
Trying to initialize it to a null value like
new Foo({"bar": null});
will instead set bar to an empty Bar object.
This happens because the constructor tests for undefined values, but not for null.
In addition to direct user calls, the internal copyList and copyMap functions introduced for THRIFT-3122 now often trigger this by initializing one object from another, making it hard to work around.