Skip to content

Commit

Permalink
bug #35537 [Config][XmlReferenceDumper] Prevent potential \TypeError …
Browse files Browse the repository at this point in the history
…(fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[Config][XmlReferenceDumper] Prevent potential \TypeError

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #34841
| License       | MIT
| Doc PR        | -

`$key` can be null and `setName()` is now typed with `string`. Fallbacking on an empty string restores the behavior (and output) of < 5.0.

However, that shows that's a case we don't handle (yet) properly. But that's another task 😃

Commits
-------

e8ba15e [Config][XmlReferenceDumper] Prevent potential \TypeError
  • Loading branch information
nicolas-grekas committed Feb 3, 2020
2 parents 435f4d5 + e8ba15e commit c29989d
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -91,7 +91,7 @@ private function writeNode(NodeInterface $node, int $depth = 0, bool $root = fal
}

if ($prototype instanceof PrototypedArrayNode) {
$prototype->setName($key);
$prototype->setName($key ?? '');
$children = [$key => $prototype];
} elseif ($prototype instanceof ArrayNode) {
$children = $prototype->getChildren();
Expand Down

0 comments on commit c29989d

Please sign in to comment.