浏览代码

fixed usage of LIBXML_COMPACT as it is not always available

Fabien Potencier 13 年之前
父节点
当前提交
17af13813a

+ 1 - 1
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

@@ -209,7 +209,7 @@ class XmlFileLoader extends FileLoader
     {
     {
         $dom = new \DOMDocument();
         $dom = new \DOMDocument();
         libxml_use_internal_errors(true);
         libxml_use_internal_errors(true);
-        if (!$dom->load($file, LIBXML_COMPACT)) {
+        if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
             throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors()));
             throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors()));
         }
         }
         $dom->validateOnParse = true;
         $dom->validateOnParse = true;

+ 1 - 1
src/Symfony/Component/Routing/Loader/XmlFileLoader.php

@@ -152,7 +152,7 @@ class XmlFileLoader extends FileLoader
     {
     {
         $dom = new \DOMDocument();
         $dom = new \DOMDocument();
         libxml_use_internal_errors(true);
         libxml_use_internal_errors(true);
-        if (!$dom->load($file, LIBXML_COMPACT)) {
+        if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
             throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors()));
             throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors()));
         }
         }
         $dom->validateOnParse = true;
         $dom->validateOnParse = true;

+ 1 - 1
src/Symfony/Component/Translation/Loader/XliffFileLoader.php

@@ -52,7 +52,7 @@ class XliffFileLoader implements LoaderInterface
     {
     {
         $dom = new \DOMDocument();
         $dom = new \DOMDocument();
         $current = libxml_use_internal_errors(true);
         $current = libxml_use_internal_errors(true);
-        if (!@$dom->load($file, LIBXML_COMPACT)) {
+        if (!@$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
             throw new \RuntimeException(implode("\n", $this->getXmlErrors()));
             throw new \RuntimeException(implode("\n", $this->getXmlErrors()));
         }
         }
 
 

+ 1 - 1
src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php

@@ -176,7 +176,7 @@ class XmlFileLoader extends FileLoader
     {
     {
         $dom = new \DOMDocument();
         $dom = new \DOMDocument();
         libxml_use_internal_errors(true);
         libxml_use_internal_errors(true);
-        if (!$dom->load($file, LIBXML_COMPACT)) {
+        if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
             throw new MappingException(implode("\n", $this->getXmlErrors()));
             throw new MappingException(implode("\n", $this->getXmlErrors()));
         }
         }
         if (!$dom->schemaValidate(__DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd')) {
         if (!$dom->schemaValidate(__DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd')) {