Fixed bug #3819: t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') delivers wrong value...
authorSteffen Kamper <info@sk-typo3.de>
Thu, 12 Aug 2010 20:42:12 +0000 (20:42 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Thu, 12 Aug 2010 20:42:12 +0000 (20:42 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-4@8589 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_div.php
t3lib/class.t3lib_fullsearch.php
t3lib/class.t3lib_querygenerator.php
tests/t3lib/cache/backend/t3lib_cache_backend_filebackendTest.php

index 312a2df..20d8d13 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 
 2010-08-12 Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #3819: t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') delivers wrong value in Backend
        * Fixed bug #15020: Enhancement of t3lib_div::testInt (Thanks to Michiel Roos)
        * Fixed bug #15029: Testcase for t3lib_div::isFirstPartOfStr is missing. (Thanks to Nikolas Hagestein)
 
index 1886b16..aab767d 100644 (file)
@@ -4055,6 +4055,8 @@ final class t3lib_div {
                                $retVal = $_SERVER[$getEnvName];
                        break;
                        case 'TYPO3_DOCUMENT_ROOT':
+                               // Get the web root (it is not the root of the TYPO3 installation)
+                               // The absolute path of the script can be calculated with TYPO3_DOCUMENT_ROOT + SCRIPT_FILENAME
                                // Some CGI-versions (LA13CGI) and mod-rewrite rules on MODULE versions will deliver a 'wrong' DOCUMENT_ROOT (according to our description). Further various aliases/mod_rewrite rules can disturb this as well.
                                // Therefore the DOCUMENT_ROOT is now always calculated as the SCRIPT_FILENAME minus the end part shared with SCRIPT_NAME.
                                $SFN = self::getIndpEnv('SCRIPT_FILENAME');
index b8124f8..9eff88e 100644 (file)
@@ -850,7 +850,7 @@ class t3lib_fullsearch {
        function makeValueList($fN, $fV, $conf, $table, $splitString) {
                $fieldSetup = $conf;
                if ($fieldSetup['type'] == 'files') {
-                       $d = dir(t3lib_div::getIndpEnv(TYPO3_DOCUMENT_ROOT).'/'.$fieldSetup['uploadfolder']);
+                       $d = dir(PATH_site . $fieldSetup['uploadfolder']);
                        while (false !== ($entry = $d->read())) {
                                if ($entry == '.' || $entry == '..') {
                                        continue;
index f0d4ab4..351f79a 100644 (file)
@@ -752,7 +752,7 @@ class t3lib_queryGenerator  {
                                        }
                                }
                        }
-                       $d = dir(t3lib_div::getIndpEnv(TYPO3_DOCUMENT_ROOT).'/'.$fieldSetup['uploadfolder']);
+                       $d = dir(PATH_site . $fieldSetup['uploadfolder']);
                        while (false !== ($entry=$d->read()))   {
                                if ($entry=='.' || $entry=='..')        {
                                        continue;
index 1229215..bb009d4 100644 (file)
@@ -238,7 +238,7 @@ class t3lib_cache_backend_FileBackendTest extends tx_phpunit_testcase {
                $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
                $backend = $this->getMock('t3lib_cache_backend_FileBackend', array('isCacheFileExpired'), array(), '', FALSE);
-               $fullPathToCacheFile = t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') . '/typo3temp/cache/UnitTestCache/ExpiredEntry';
+               $fullPathToCacheFile = PATH_site . 'typo3temp/cache/UnitTestCache/ExpiredEntry';
                $backend->expects($this->once())->method('isCacheFileExpired')->with($fullPathToCacheFile)->will($this->returnValue(TRUE));
                $backend->setCache($mockCache);