mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
fixed bug in _create_dir_structure() when used with
open_basedir-restriction and relative paths
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
|||||||
|
- fixed bug in _create_dir_structure() when used with open_basedir-
|
||||||
|
restriction and relative paths (messju)
|
||||||
- use DIRECTORY_SEPARATOR exclusively, keep DIR_SEP for BC (Monte)
|
- use DIRECTORY_SEPARATOR exclusively, keep DIR_SEP for BC (Monte)
|
||||||
- changed "link" to "href" in html_image. "link" is still working
|
- changed "link" to "href" in html_image. "link" is still working
|
||||||
but deprecated (messju)
|
but deprecated (messju)
|
||||||
|
@@ -2130,10 +2130,12 @@ class Smarty
|
|||||||
*/
|
*/
|
||||||
function _create_dir_structure($dir)
|
function _create_dir_structure($dir)
|
||||||
{
|
{
|
||||||
if (!file_exists($dir)) {
|
if (!file_exists($dir)) {
|
||||||
|
$_new_dir = (preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $dir))
|
||||||
|
? DIRECTORY_SEPARATOR : getcwd().DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
$_dir_parts = preg_split('!\\' . DIRECTORY_SEPARATOR . '+!', $dir, -1, PREG_SPLIT_NO_EMPTY);
|
$_dir_parts = preg_split('!\\' . DIRECTORY_SEPARATOR . '+!', $dir, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
$_new_dir = ($dir{0} == DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : '';
|
|
||||||
|
|
||||||
// do not attempt to test or make directories outside of open_basedir
|
// do not attempt to test or make directories outside of open_basedir
|
||||||
$_open_basedir_ini = ini_get('open_basedir');
|
$_open_basedir_ini = ini_get('open_basedir');
|
||||||
if(!empty($_open_basedir_ini)) {
|
if(!empty($_open_basedir_ini)) {
|
||||||
@@ -2146,7 +2148,6 @@ class Smarty
|
|||||||
|
|
||||||
foreach ($_dir_parts as $_dir_part) {
|
foreach ($_dir_parts as $_dir_part) {
|
||||||
$_new_dir .= $_dir_part;
|
$_new_dir .= $_dir_part;
|
||||||
|
|
||||||
if ($_use_open_basedir) {
|
if ($_use_open_basedir) {
|
||||||
$_make_new_dir = false;
|
$_make_new_dir = false;
|
||||||
foreach ($_open_basedirs as $_open_basedir) {
|
foreach ($_open_basedirs as $_open_basedir) {
|
||||||
|
Reference in New Issue
Block a user