[TYPO3-project-formidable] Bug fix: OpenBaseDir warning for file_exists
Oliver Klee
typo3-german-02 at oliverklee.de
Tue Jan 13 21:24:24 CET 2009
Hi,
because file_exists is called on a relative path that has a leading
slash (and thus is an absolute path to a nonexistent file), a customer
gets the following errors:
Warning: file_exists() [function.file-exists]: open_basedir restriction
in effect.
File(/typo3conf/ext/onetimeaccount/pi1/onetimeaccount_pi1.xml) is not
within the allowed path(s):
(/home/httpd/vhosts/poweruser.ch/subdomains/www.kvz/httpdocs:/tmp) in
/home/httpd/vhosts/poweruser.ch/subdomains/www.kvz/httpdocs/typo3/ext/ameos_formidable/api/class.tx_ameosformidable.php
on line 6052
The culprit is tx_ameosformidable::toServerPath:
function toServerPath($sPath) {
$sPath = tx_ameosformidable::toRelPath($sPath);
if(file_exists($sPath) && is_dir($sPath) && ($sPath{(strlen($sPath) -
1)} !== "/")) {
$sPath .= "/";
}
The problem is that toRelPath creates a relative path *plus a leading
slash*.
I've attached patches for the trunk and the branch. (The patches are
quite big due to the trailing whitespace in those files.)
(This took me quite a while to track down because toRelPath wasn't
commented at all and did not actually create a real relative path. Talk
about confusing code ...)
Best regards,
Oliver
More information about the TYPO3-project-formidable
mailing list