Yury Kozyrev 10 gadi atpakaļ
vecāks
revīzija
4b3fa9ff83

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

@@ -349,13 +349,14 @@ class XmlDeserializationVisitor extends AbstractVisitor
 
     /**
      * Retrieves internalSubset even in bugfixed php versions
+     *
      * @param \DOMDocumentType $child
-     * @param $data
+     * @param string $data
      * @return string
      */
     private function getDomDocumentTypeEntitySubset(\DOMDocumentType $child, $data)
     {
-        if(!$this->isBugFixedPhpVersion()){
+        if((PHP_VERSION_ID >= 50513) || (PHP_VERSION_ID >= 50429 && PHP_VERSION_ID < 50500)){
             return str_replace(array("\n", "\r"), '', $child->internalSubset);
         }
         $startPos = $endPos = stripos($data, '<!doctype');
@@ -375,14 +376,4 @@ class XmlDeserializationVisitor extends AbstractVisitor
         $internalSubset = str_replace(array("[ <!", "> ]>"), array('[<!', '>]>'), $internalSubset);
         return $internalSubset;
     }
-
-    /**
-     * Whether or not PHP internalSubset bug is fixed in current version
-     * @return boolean
-     * @link https://bugs.php.net/bug.php?id=67081
-     **/
-    private function isBugFixedPhpVersion()
-    {
-        return (PHP_VERSION_ID >= 50513) || (PHP_VERSION_ID >= 50429 && PHP_VERSION_ID < 50500);
-    }
 }

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

@@ -115,7 +115,6 @@ class XmlSerializationTest extends BaseSerializationTest
 
     public function testWhitelistedDocumentTypesAreAllowed()
     {
-        
         $this->deserializationVisitors->get('xml')->get()->setDoctypeWhitelist(array(
             '<!DOCTYPE authorized SYSTEM "http://authorized_url.dtd">',
             '<!DOCTYPE author [<!ENTITY foo SYSTEM "php://filter/read=convert.base64-encode/resource='.basename(__FILE__).'">]>'));