Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DependencyInjection] Use DOM instead of SimpleXML for namespace support #10619

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 2 commits into from
Apr 2, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
[DependencyInjection] Deprecate SimpleXMLElement
  • Loading branch information
romainneutron committed Apr 2, 2014
commit a3c60c8039d90a4a9da3325c90b2b16a20e3f53f
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/DependencyInjection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* added DecoratorServicePass and a way to override a service definition (Definition::setDecoratedService())
* deprecated SimpleXMLElement class.

2.4.0
-----
Expand Down
27 changes: 5 additions & 22 deletions 27 src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,37 +197,20 @@ private function parseDefinition($id, \DOMElement $service, $file)
$parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue);
}
// keep not normalized key for BC too
$parameters[$name] = SimpleXMLElement::phpize($value);
$parameters[$name] = XmlUtils::phpize($node->nodeValue);
}

// $definition->addTag((string) $tag['name'], $parameters);
$definition->addTag($tag->getAttribute('name'), $parameters);
}

if (isset($service['decorates'])) {
$renameId = isset($service['decoration-inner-name']) ? (string) $service['decoration-inner-name'] : null;
$definition->setDecoratedService((string) $service['decorates'], $renameId);
if ($value = $service->getAttribute('decorates')) {
$renameId = $service->hasAttribute('decoration-inner-name') ? $service->getAttribute('decoration-inner-name') : null;
$definition->setDecoratedService($value, $renameId);
}

$this->container->setDefinition($id, $definition);
}

/**
* Parses a XML file.
*
* @param string $file Path to a file
*
* @return SimpleXMLElement
*
* @throws InvalidArgumentException When loading of XML file returns error
*/
protected function parseFile($file)
{
$dom = $this->parseFileToDOM($file);

return simplexml_import_dom($dom, 'Symfony\\Component\\DependencyInjection\\SimpleXMLElement');
}

/**
* Parses a XML file to a \DOMDocument
*
Expand All @@ -237,7 +220,7 @@ protected function parseFile($file)
*
* @throws InvalidArgumentException When loading of XML file returns error
*/
protected function parseFileToDOM($file)
private function parseFileToDOM($file)
{
try {
$dom = XmlUtils::loadFile($file, array($this, 'validateSchema'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* SimpleXMLElement class.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated Deprecated since version 2.5, to be removed in 3.0.
*/
class SimpleXMLElement extends \SimpleXMLElement
{
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.