Issue Bug Closed

#19432getHtmlTemplate should use resolveBackPath

Steffen Gebert 10/08/08, 09:33 updated 01/21/09, 10:07

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)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.