Project

General

Profile

Actions

Bug #70773

closed

Logical Error in getFileAbsFileName()?

Added by Gregor Titze over 8 years ago. Updated over 8 years ago.

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

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Looking for some other stuff i just figured out that the condition on line 3727 of the GeneralUtility.php in the 7.5.0 Typo3 release seems not logical to me.

Calling GeneralUtility::getFileAbsFileName() with $onlyRelative = TRUE should from my understanding set the $filename to an empty string if the path is an absolute path - this is what the comment proposes. However, only if self::isFirstPartOfStr($filename, $relPathPrefix) === TRUE this path is actually an absolute path in PATH_site.

Therefore, the negation seems to make the function misbehave regarding its documentation. Or am I wrong?

Actions #1

Updated by Mathias Schreiber over 8 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Mathias Schreiber

Hi Gregor,

I think you might mistake absolute path and absolute path within PATH_site.
Take a look at this:


$testPath1 = GeneralUtility::getFileAbsFileName('/var/www/cms7/icon.png');
$testPath2 = GeneralUtility::getFileAbsFileName('/var/www/cms7/icon.png', false);
$testPath3 = GeneralUtility::getFileAbsFileName('/var/www/cms7/Web/index.php');

$testPath1 and $testPath2 are both outside of PATH_site.
Thus $testPath1 returns an empty string, while $testPath2 returns the full path.

Did this clear things up a bit?

Actions #2

Updated by Gregor Titze over 8 years ago

Thank you Matthias for clearing up.

I had actually just not read diligently enough. Thus, I hadn't considered the previous condition and had missed the condition checking for the absolute path.

Next time I will think once more before posting, sorry for occupying your time with this ;)

Actions #3

Updated by Mathias Schreiber over 8 years ago

  • Status changed from Needs Feedback to Closed

Hi Gregor,

no sweat, remember: there are no stupid questions :)

Actions

Also available in: Atom PDF