Several Wikibase extensions use array_merge_recursive() to combine multiple “definitions” arrays (mappings from entity or data type names to various definitions – formatter factory callback, RDF builder factory callback, etc.). However, this is dangerous – when more than one input array has a non-array value for the same (nested) key, array_merge_recursive() will merge the values into an array:
>>> array_merge_recursive( [ 'a' => 1 ], [ 'a' => 2 ] ) => [ "a" => [ 1, 2 ] ]
But an array is not a valid value for most definitions, and depending the key where this happens, it can bring down the whole site (as it did in T287100). We don’t really want a fully recursive merge of these arrays – just one level deeper than a standard array_merge() (the arrays for each type should be added non-recursively).
Acceptance Criteria: 🏕️🌟
- All "definitions" are fixed EntityTypeDefinitions & DataTypeDefinitions
- All extensions are fixed that use these (Probably Wikibase, WikibaseLexeme, WikibaseMediaInfo, WikibaseCirrusSearch, WikibaseLexemeCirrusSearch but others should be checked too)