Bug #19432
closedgetHtmlTemplate should use resolveBackPath
0%
Description
getHtmlTemplate() in typo3/template.php:
t3lib_div::getURL($this->backPath . $filename)
For tt_news $this->backPath . $filename = "../../../../typo3/../typo3conf/ext/tt_news/mod1/mod_ttneypo3conf/ext/tt_news/mod1/mod_ttnews_admin.html" which can't be opened on some linux servers.
resolveBackPath removes "typo3/../" which works.
The attached patch changes getHtmlTemplate() to use resolveBackPath().
PHP-function realpath() usually should do this job (following manual) but seems to have some problems (different implementations in different PHP versions / platforms; suhosin replaces default implementation). My Server with 5.2.3 and suhosin returned wrong path: /var/www/vhosts/dmm.travel/subdomains/dev/httpdocs/typo3_src_svn_trunk/typo3conf/ext/tt_news/mod1/mod_ttnews_admin.html
t3lib_div::getFileAbsFileName() also doesn't work (returns nothing), seems to have problems with paths starting with ../ which is IMHO bad behaviour.
For debugging you might place the following code in typo3/template.php:getHtmlPath():
echo t3lib_div::print_array(
array(
'raw' => $this->backPath . $filename,
'realpath' => realpath($this->backPath . $filename),
'resolveBackPath' => t3lib_div::resolveBackPath($this->backPath . $filename),
'getFileAbsFilename(resolveBackPath)' => t3lib_div::getFileAbsFileName(t3lib_div::resolveBackPath($this->backPath . $filename)),
)
);
(issue imported from #M9511)
Files
Updated by Steffen Gebert about 16 years ago
Sorry, I pasted a wrong path.
The generated path is:
../../../../typo3/../typo3conf/ext/tt_news/mod1/mod_ttnews_admin.html
This problem seems to be cause by the symlink typo3 -> typo3_src/typo3.
The path can't also be opened by command line programs (`cat` etc). After replacing typo3/../ with typo3temp/../ `cat` works. So must be symlink.
Updated by Michiel Roos almost 16 years ago
This is especially tragic in cases where an extension outside of TYPO3 want's to use doc headers . . .
since resolveBackpath will not resolve ../../../../typo3 etc.
Updated by Steffen Gebert almost 16 years ago
There are already three +1 in core-list.
Don't know why it hasn't been commited, yet.
Updated by Ernesto Baschny almost 16 years ago
Commited to trunk (rev.4559) and TYPO3 4.2 (rev.4560).