[TASK] Check for libxml bug in install tool 89/25089/11
authorTomita Militaru <militarutomita@gmail.com>
Thu, 31 Oct 2013 10:44:17 +0000 (12:44 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 13 Jan 2014 20:53:10 +0000 (21:53 +0100)
Add check for libxml bug when saving special characters ">><<"
in a flexform

Resolves: #51271
Releases: 6.2
Change-Id: I5d120cdfeb9538209273c8761d017cb67256617b
Reviewed-on: https://review.typo3.org/25089
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Oliver Klee
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 83953f1..16fbe51 100644 (file)
@@ -118,6 +118,7 @@ class Check {
                $statusArray[] = $this->checkGdLibFreeTypeSupport();
                $statusArray[] = $this->checkPhpMagicQuotes();
                $statusArray[] = $this->checkRegisterGlobals();
+               $statusArray[] = $this->checkLibXmlBug();
                $statusArray[] = $this->isTrueTypeFontDpiStandard();
                return $statusArray;
        }
@@ -395,7 +396,7 @@ class Check {
                                'These function(s) are disabled. TYPO3 uses currently none of those, so you are good to go.'
                        );
                } else {
-                       $status  = new Status\OkStatus();
+                       $status = new Status\OkStatus();
                        $status->setTitle('No disabled PHP functions');
                }
                return $status;
@@ -922,7 +923,7 @@ class Check {
                        $status = new Status\OkStatus();
                        $status->setTitle('PHP GD library has jpg support');
                } else {
-                       $status= new Status\ErrorStatus();
+                       $status = new Status\ErrorStatus();
                        $status->setTitle('PHP GD library jpg support missing');
                        $status->setMessage(
                                'GD must be compiled with jpg support. This is essential for' .
@@ -1089,6 +1090,33 @@ class Check {
        }
 
        /**
+        * Check for bug in libxml
+        *
+        * @return Status\StatusInterface
+        */
+       protected function checkLibXmlBug() {
+               $sampleArray = array('Test>><<Data');
+
+               $xmlContent = '<numIndex index="0">Test&gt;&gt;&lt;&lt;Data</numIndex>' . LF;
+
+               $xml = \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml($sampleArray, '', -1);
+
+               if ($xmlContent !== $xml) {
+                       $status = new Status\ErrorStatus();
+                       $status->setTitle('PHP libxml bug present');
+                       $status->setMessage(
+                               'Some hosts have problems saving ">><<" in a flexform.' .
+                               ' To fix this, enable [BE][flexformForceCDATA] in' .
+                               ' All Configuration.'
+                       );
+               } else {
+                       $status = new Status\OkStatus();
+                       $status->setTitle('PHP libxml bug not present');
+               }
+               return $status;
+       }
+
+       /**
         * Helper methods
         */