Project

General

Profile

Actions

Bug #19432

closed

getHtmlTemplate should use resolveBackPath

Added by Steffen Gebert over 15 years ago. Updated over 15 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2008-10-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

getHtmlTemplate-resolveBackPath.patch (611 Bytes) getHtmlTemplate-resolveBackPath.patch Administrator Admin, 2008-10-08 09:33

Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #19416: getHtmlTemplate should use resolveBackPathClosedChristian Kuhn2008-10-05

Actions
Actions #1

Updated by Steffen Gebert over 15 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.

Actions #2

Updated by Michiel Roos over 15 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.

Actions #3

Updated by Steffen Gebert over 15 years ago

There are already three +1 in core-list.
Don't know why it hasn't been commited, yet.

Actions #4

Updated by Ernesto Baschny over 15 years ago

Commited to trunk (rev.4559) and TYPO3 4.2 (rev.4560).

Actions

Also available in: Atom PDF