Bug #20656
closedt3lib_cache_backend_FileBacked violates open_basedir_restrictions
0%
Description
t3lib_cache_backend_FileBacked::set violates open_basedir_restrictions due to the fact that it tries to travers the cacheEntryPath from the very beginning using t3lib_div::mkdir_deep. Mkdir checks every part of the whole path for existens (is_dir) which obviosly fails when open base dir restrictions take place.
A common practice is to put all vhost beyond a certain directory usually /var/www/virtual or similar.
In this case mkdir_deep will fail at "/var" since open base_dir_restrictions are preventing it from accessing that directory (which is a good idea in general)
Currently the only workarround i am aware of is to add /var (or whatever) to "open base dir" which obviosly raises security issues.
Note: this error is pretty tricky to reproduce under certain circumstances ( if eaccelerator is enabled). Instead of "could not create cache directory' you will receive a Tx_Fluid_Core_ParsingException complaining about missing reflection information. To get the actuall error message clean the eAccelerator cache, stop/start the apache, clear the T3 cache and hit your webbrowser's reload button ;).
(issue imported from #M11386)
Files
Updated by Nikolas Hagelstein over 15 years ago
Perhaps it's a good idea to remove the TYPO3 docroot from the mkdir_deep check since it should exist anyway. Would increase the function's overall performance as well ;).
Updated by Ruetschi Romain over 15 years ago
The patch I just attached is not complete, sorry.
There is another call to t3lib_div::mkdir_deep which needs to be fixed.
It may be be better to change $this->root from '/' to PATH_site instead of supplying PATH_site to t3lib_div::mkdir_deep.
Anyway, I think the best solution is Nikolas one.
Updated by Christian Kuhn about 15 years ago
Confirmed.
IMHO $this->root in t3lib_cache_backend_FileBacked should be changed from / to PATH_site or something.
Updated by Rupert Germann about 15 years ago
I attached a new patch which fixes the problem also under windows and for relative and absolute paths.
Updated by Steffen Kamper over 14 years ago
Committed v4 to svn
4_3 rev 7226
trunk rev 7227