Bug #16335
closedt3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') delivers wrong value in Backend
0%
Description
When in backend mode, t3lib_div::getIndpEnv() delivers a wrong value when asked for 'TYPO3_DOCUMENT_ROOT'. When the root of your TYPO3-Installation is e.g. located in /srv/www/htdocs/t3inst/, it returns /srv/www/htdocs/t3inst/typo3/.
I suppose this happens because getIndpEnv uses SCRIPT_FILENAME for getting the document-root. When in backend-mode, this path is {real doc-root}/typo3/xyz.php, so the
Additionally, the value is always wrong when the whole TYPO3-dir is a symlink to another location, e.g. when /srv/www/htdocs/t3inst/ points to /srv/www/t3inst-real/.
(issue imported from #M3819)
Files
Updated by Andreas Wolf over 18 years ago
Well, I found out that this isn't a real bug in t3lib_div, but in the extension I used. The problem was that the extension called browse_links.php with a path containing two slashes, i.e. typo3//browse_links.php. This made getIndpEnv return an incorrect value for DOCUMENT_ROOT.
Perhaps there should be a clause that filters out double slashes etc. to avoid such errors in the future.
The problem with the symlink persists, btw.
Updated by Christian Kuhn over 15 years ago
Confirmed: TYPO3_DOCUMENT_ROOT is wrong if installaltion symlinked (I think) / and or a subpath.
Stumbled upon this in the query generator for file fields.
Updated by Peter Niederlag over 14 years ago
Is this still a problem? In which menu/function/extension does this bug show up? Can it be reproduced somehow? Big Thx for any further hints.
Updated by Christian Kuhn over 14 years ago
Still valid, at least if an installation is in a subdirectory.
Updated by Steffen Kamper over 14 years ago
My patch was wrong. Fact is that TYPO3_DOCUMENT_ROOT works as expected, it delivers the apache web root.
What is wrong is the usage - don't expect to compose the absolute path of a file with this var, use PATH_site instead. Attached v2 adds these comment to TYPO3_DOCUMENT_ROOT and fixes wrong usage in core:
// 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
Updated by Steffen Kamper over 14 years ago
Committed to svn
4_2 rev 8587
4_3 rev 8588
4_4 rev 8589
trunk rev 8590