Issues

ZF-9642: Zend_Cache_Backend_Static attempting to access folders outside of basedir

Description

ZF VERSION = '1.11.0dev'

I get following errors in Zend_Cache_Backend_Static whilst implementing page caching {quote} [09-Apr-2010 11:46:18] PHP Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 269 [09-Apr-2010 11:46:18] PHP Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 270 [09-Apr-2010 11:46:18] PHP Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/var) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 269 [09-Apr-2010 11:46:18] PHP Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/var) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 270 [09-Apr-2010 11:46:18] PHP Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/var/www) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 269 [09-Apr-2010 11:46:18] PHP Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/var/www) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 270 [09-Apr-2010 11:46:18] PHP Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/var/www/vhosts) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 269 [09-Apr-2010 11:46:18] PHP Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/var/www/vhosts) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 270 [09-Apr-2010 11:46:18] PHP Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/var/www/vhosts/fairfax.org.uk) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 269 [09-Apr-2010 11:46:18] PHP Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/var/www/vhosts/fairfax.org.uk) is not within the allowed path(s): (/var/www/vhosts/fairfax.org.uk/httpdocs:/var/www/vhosts/fairfax.org.uk/application:/tmp:/usr/local/ZWare/libv2:/usr/local/Zend/Core/share/pear) in /usr/local/ZWare/libv2/Zend/Cache/Backend/Static.php on line 270 {quote}

i.e right up where the path is allowed In this instance, the public_dir is set up as '/var/www/vhosts/fairfax.org.uk/httpdocs/pagecache' for 'Static' backend and open_basedir is set for '/var/www/vhosts/fairfax.org.uk/httpdocs' as you can see in the error messages.

The problem is in the _createDirectoriesFor() method which is trying to create all the way back from root even though it is unlikely that would ever be in an open basedir.

Suggestions: quick fix: suppress errors longer term fix: Check if open_basedir restriction is in effect and then try a match to allowed paths, using a matched one as a starting point for directory creation if found.

Comments

fixed in r22644 (trunk) & r22645 (1.10 branch)

-> create directories recursive using third argument of mkdir

Hi Marc Could make tests units?

Thanks advance.

Greetings Ramon