Johannes Schmitt 10 年 前
コミット
e619ca451a

+ 3 - 0
src/JMS/Serializer/XmlDeserializationVisitor.php

@@ -359,6 +359,7 @@ class XmlDeserializationVisitor extends AbstractVisitor
         if (null !== $child->internalSubset) {
             return str_replace(array("\n", "\r"), '', $child->internalSubset);
         }
+        
         $startPos = $endPos = stripos($data, '<!doctype');
         $braces = 0;
         do {
@@ -370,10 +371,12 @@ class XmlDeserializationVisitor extends AbstractVisitor
                 --$braces;
             }
         } while ($braces > 0);
+
         $internalSubset = substr($data, $startPos, $endPos - $startPos);
         $internalSubset = str_replace(array("\n", "\r"), '', $internalSubset);
         $internalSubset = preg_replace('/\s{2,}/', ' ', $internalSubset);
         $internalSubset = str_replace(array("[ <!", "> ]>"), array('[<!', '>]>'), $internalSubset);
+
         return $internalSubset;
     }
 }

+ 0 - 23
src/JMS/Serializer/XmlDeserializationVisitor.php.rej

@@ -1,23 +0,0 @@
---- /dev/null
-+++ /dev/null
-@@ -356,17 +356,17 @@
-      */
-     private function getDomDocumentTypeEntitySubset(\DOMDocumentType $child, $data)
-     {
--        if(null !== $child->internalSubset){
-+        if(null !== $child->internalSubset) {
-             return str_replace(array("\n", "\r"), '', $child->internalSubset);
-         }
-         $startPos = $endPos = stripos($data, '<!doctype');
-         $braces = 0;
-         do {
-             $char = $data[$endPos++];
--            if($char === '<'){
-+            if($char === '<') {
-                 ++$braces;
-             }
--            if($char === '>'){
-+            if($char === '>') {
-                 --$braces;
-             }
-         } while ($braces > 0);

+ 0 - 1
tests/JMS/Serializer/Tests/Serializer/BaseSerializationTest.php

@@ -584,7 +584,6 @@ abstract class BaseSerializationTest extends \PHPUnit_Framework_TestCase
 
     public function testFormErrorsWithNonFormComponents()
     {
-
         if (!class_exists('Symfony\Component\Form\Extension\Core\Type\SubmitType')) {
             $this->markTestSkipped('Not using Symfony Form >= 2.3 with submit type');
         }

+ 0 - 2
tests/JMS/Serializer/Tests/Serializer/XmlSerializationTest.php

@@ -93,7 +93,6 @@ class XmlSerializationTest extends BaseSerializationTest
      */
     public function testExternalEntitiesAreDisabledByDefault()
     {
-        
         $this->deserialize('<?xml version="1.0"?>
             <!DOCTYPE author [
                 <!ENTITY foo SYSTEM "php://filter/read=convert.base64-encode/resource='.basename(__FILE__).'">
@@ -109,7 +108,6 @@ class XmlSerializationTest extends BaseSerializationTest
      */
     public function testDocumentTypesAreNotAllowed()
     {
-        
         $this->deserialize('<?xml version="1.0"?><!DOCTYPE foo><foo></foo>', 'stdClass');
     }