Page MenuHomePhabricator

When building a generic ZObject, build the children args before calling the ZObject constructor
Closed, ResolvedPublic

Description

When creating an instance of a built-in type, the ZObjectFactory::createKeyValues checks that all the required key-values are there, builds the child ZObjects, detects whatever errors can be found while doing that, and finally, calls the constructor of that built-in type.

E.g. When creating a ZType, we first create each ZKey instance, and then we pass those to the ZType constructor.

With non-built-ins, we directly call ZObject constructor without checking the child ZObjects. However, ZObject::getZKeyValue method calls ZObjectFactory on the key-values on the getter. This means that if there's an error in the inner data, we will not find it during creation process, but only when we run the getter on a particular key.

Change this so that all construction mechanisms (irrespective to whether it's a builtin or we are using the generic ZObject) build the args and then call the constructor with all the children built.

Event Timeline

Change 761656 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Build ZObject args before calling ZObject constructor

https://gerrit.wikimedia.org/r/761656

Change 761656 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Build ZObject args before calling ZObject constructor

https://gerrit.wikimedia.org/r/761656