[BUGFIX] Prevent fatal error in stdWrap when compatibility6 is not loaded 05/44805/2
authorMarkus Klein <markus.klein@typo3.org>
Thu, 19 Nov 2015 17:48:56 +0000 (18:48 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 19 Nov 2015 19:56:33 +0000 (20:56 +0100)
When extracting compatibility6 it was forgotten to tackle stdWrap offsetWrap,
which uses a class of compatibility6.

We add a check for the extension and a deprecation notice to not use this
(really outdated) stdWrap anymore.

Resolves: #71704
Releases: master
Change-Id: I83d2ede014efd32a0241372df32f333d55f091ce
Reviewed-on: https://review.typo3.org/44805
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index af1ea71..7b9c812 100644 (file)
@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Frontend\ContentObject;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Compatibility6\ContentObject\OffsetTableContentObject;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\FrontendEditing\FrontendEditingController;
 use TYPO3\CMS\Core\Html\HtmlParser;
@@ -3730,24 +3729,30 @@ class ContentObjectRenderer
      * @param string $content Input value undergoing processing in this function.
      * @param array $conf stdWrap properties for offsetWrap.
      * @return string The processed input value
+     * @deprecated since CMS 7, will be removed with CMS 8 without replacement
      */
     public function stdWrap_offsetWrap($content = '', $conf = array())
     {
-        $controlTable = GeneralUtility::makeInstance(OffsetTableContentObject::class);
-        if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {
-            $controlTable->tableParams = isset($conf['offsetWrap.']['tableParams.'])
-                ? $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.'])
-                : $conf['offsetWrap.']['tableParams'];
-        }
-        if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {
-            $controlTable->tdParams = ' ' . (isset($conf['offsetWrap.']['tdParams.'])
-                ? $this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.'])
-                : $conf['offsetWrap.']['tdParams']);
-        }
-        $content = $controlTable->start($content, $conf['offsetWrap']);
-        if ($conf['offsetWrap.']['stdWrap.']) {
-            $content = $this->stdWrap($content, $conf['offsetWrap.']['stdWrap.']);
+        GeneralUtility::logDeprecatedFunction();
+
+        if (ExtensionManagementUtility::isLoaded('compatibility6')) {
+            $controlTable = GeneralUtility::makeInstance(TYPO3\CMS\Compatibility6\ContentObject\OffsetTableContentObject::class);
+            if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {
+                $controlTable->tableParams = isset($conf['offsetWrap.']['tableParams.'])
+                    ? $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.'])
+                    : $conf['offsetWrap.']['tableParams'];
+            }
+            if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {
+                $controlTable->tdParams = ' ' . (isset($conf['offsetWrap.']['tdParams.'])
+                        ? $this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.'])
+                        : $conf['offsetWrap.']['tdParams']);
+            }
+            $content = $controlTable->start($content, $conf['offsetWrap']);
+            if ($conf['offsetWrap.']['stdWrap.']) {
+                $content = $this->stdWrap($content, $conf['offsetWrap.']['stdWrap.']);
+            }
         }
+
         return $content;
     }