8000 [DependencyInjection] fix DOM element namespace URL access by xabbuh · Pull Request #29992 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] fix DOM element namespace URL access #29992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ private function validateAlias(\DOMElement $alias, $file)
}

foreach ($alias->childNodes as $child) {
if (!$child instanceof \DOMElement && self::NS !== $child->namespaceURI) {
if (!$child instanceof \DOMElement || self::NS !== $child->namespaceURI) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more 64E8 .

Originally there was no continue statement (this was introduced in #29968). The condition before read like this:

if ($child instanceof \DOMElement && self::NS === $child->namespaceURI) {
    throw new InvalidArgumentException(sprintf('Invalid child element "%s" defined for alias "%s" in "%s".', $child->localName, $alias->getAttribute('id'), $file));
}

This change ensures that we do not access a potentially not existing $namespaceURI property when $child is no DOMElement instance.

continue;
}
if (!\in_array($child->localName, ['deprecated'], true)) {
Expand Down
0