Bug #70773
closed
Logical Error in getFileAbsFileName()?
Added by Gregor Titze about 9 years ago.
Updated about 9 years ago.
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?
- 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?
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 ;)
- Status changed from Needs Feedback to Closed
Hi Gregor,
no sweat, remember: there are no stupid questions :)
Also available in: Atom
PDF