[BUGFIX] Don't use folders as templates, partials and layouts
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Sat, 13 Apr 2013 17:11:49 +0000 (19:11 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 14 Apr 2013 11:25:40 +0000 (13:25 +0200)
The file_exists checks in TemplateView and StandaloneView are true for
folders. This leads to unrendered partials with resorted paths.
Use is_file.

Releases: 6.1, 6.0, 4.7, 1.3
Fixes: #47186
Fluid Package Issue: #47188

Change-Id: Ib64e180e01d66777bb5b0683cce26d88ec2a9fd6
Reviewed-on: https://review.typo3.org/19970
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/fluid/Classes/View/StandaloneView.php
typo3/sysext/fluid/Classes/View/TemplateView.php

index bbc3db1..1fc524d 100644 (file)
@@ -272,7 +272,7 @@ class Tx_Fluid_View_StandaloneView extends Tx_Fluid_View_AbstractTemplateView {
                $possibleLayoutPaths[] = t3lib_div::fixWindowsFilePath($layoutRootPath . '/' . $layoutName);
                $found = FALSE;
                foreach($possibleLayoutPaths as $layoutPathAndFilename) {
-                       if (file_exists($layoutPathAndFilename)) {
+                       if (is_file($layoutPathAndFilename)) {
                                $found = TRUE;
                            break;
                        }
@@ -302,7 +302,7 @@ class Tx_Fluid_View_StandaloneView extends Tx_Fluid_View_AbstractTemplateView {
                $possiblePartialPaths[] = t3lib_div::fixWindowsFilePath($partialRootPath . '/' . $partialName);
                $found = FALSE;
                foreach($possiblePartialPaths as $partialPathAndFilename) {
-                       if (file_exists($partialPathAndFilename)) {
+                       if (is_file($partialPathAndFilename)) {
                                $found = TRUE;
                            break;
                        }
index c70463f..16b0b2a 100644 (file)
@@ -182,7 +182,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Fluid_View_AbstractTemplateView {
                                // These tokens are replaced by the Backporter for the graceful fallback in version 4.
                                $fallbackPath = str_replace('@action', $actionName, $templatePathAndFilename);
                                $templatePathAndFilename = str_replace('@action', ucfirst($actionName), $templatePathAndFilename);
-                               if (file_exists($templatePathAndFilename)) {
+                               if (is_file($templatePathAndFilename)) {
                                        $found = TRUE;
                                        // additional check for deprecated template filename for case insensitive file systems (Windows)
                                        $realFileName = basename(realpath($templatePathAndFilename));
@@ -190,7 +190,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Fluid_View_AbstractTemplateView {
                                                t3lib_div::deprecationLog('the template filename "' . t3lib_div::fixWindowsFilePath(realpath($templatePathAndFilename)) . '" is lowercase. This is deprecated since TYPO3 4.4. Please rename the template to "' . basename($templatePathAndFilename) . '"');
                                        }
                                        break;
-                               } elseif (file_exists($fallbackPath)) {
+                               } elseif (is_file($fallbackPath)) {
                                        t3lib_div::deprecationLog('the template filename "' . $fallbackPath . '" is lowercase. This is deprecated since TYPO3 4.4. Please rename the template to "' . basename($templatePathAndFilename) . '"');
                                        $found = TRUE;
                                        $templatePathAndFilename = $fallbackPath;
@@ -230,7 +230,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Fluid_View_AbstractTemplateView {
                        $found = FALSE;
                        foreach ($paths as &$layoutPathAndFilename) {
                                $layoutPathAndFilename = str_replace('@layout', $layoutName, $layoutPathAndFilename);
-                               if (file_exists($layoutPathAndFilename)) {
+                               if (is_file($layoutPathAndFilename)) {
                                        $found = TRUE;
                                        break;
                                }
@@ -261,7 +261,7 @@ class Tx_Fluid_View_TemplateView extends Tx_Fluid_View_AbstractTemplateView {
                $found = FALSE;
                foreach ($paths as &$partialPathAndFilename) {
                        $partialPathAndFilename = str_replace('@partial', $partialName, $partialPathAndFilename);
-                       if (file_exists($partialPathAndFilename)) {
+                       if (is_file($partialPathAndFilename)) {
                                $found = TRUE;
                                break;
                        }