Fw: [SMARTY-DEV] Bug found in file function.config_load.php

From: Date: Fri, 12 Dec 2003 19:26:19 +0000
Subject: Fw: [SMARTY-DEV] Bug found in file function.config_load.php
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1982@lists.php.net to get a copy of this message
I saw cvs, to put the problem still I exist, the mentioned line $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; $smarty->_conf_obj->set_path($_config_dir); } $_config_vars = array_merge($smarty->_conf_obj->get($_file), it must be below of the key, thus: $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; } $smarty->_conf_obj->set_path($_config_dir); $_config_vars = array_merge($smarty->_conf_obj->get($_file), obs: I have some implementations of smarty, and I would like to be able to suggest and if possible he implements them in the official version of smarty if it will have some interest, I wait answers.... yours truly, bac@oops.com.br Marc Victor C Cabadas ----- Original Message ----- From: "Monte Ohrt" <monte@ispi.net> To: "bac" <bac@oops.com.br> Cc: "Smarty Dev" <smarty-dev@lists.php.net> Sent: Friday, December 12, 2003 11:38 AM Subject: Re: [SMARTY-DEV] Bug found in file function.config_load.php > fixed in CVS, thanks. > > Monte > > On Thu, 2003-12-11 at 19:52, bac wrote: > > i found a bug in function smarty_function_config_load () ; > > > > the function is congealing the variable $smarty->config_dir, > > generating a great problem when object is used the same $smarty, > > to generate two templates different with two config files in localization different, > > > > it follows below an example of use with bug reported: > > > > <? > > require('./Smarty-2.6.0/libs/Smarty.class.php'); > > $smarty = new smarty; > > $smarty->compile_check = true; > > > > // first template... > > > > $smarty->template_dir='./template_dir1'; > > $smarty->compile_dir='./compile_dir'; > > $smarty->config_dir='./template_dir1/config'; > > $smarty->assign('test','testeok'); > > $smarty->display('test.tpl'); > > > > > > // is ok ... > > // output is: > > > > $test = testeok > > #CONFIG_TEST = Test OK! > > > > // second template .. > > > > $smarty->template_dir='./template_dir2'; > > $smarty->compile_dir='./compile_dir'; > > $smarty->config_dir='./template_dir2/config'; > > $smarty->assign('test2','testeok2'); > > $smarty->display('test2.tpl'); > > > > $smarty->clear_compiled_tpl(); > > > > // is a error > > // output is: > > > > Warning: Config_File error: Could not open config file > > './template_dir1/config\test2.conf' in \Smarty-2.6.0\libs\Config_File.class.php on line > > 360 > > > > Warning: Config_File error: Could not open config file > > './template_dir1/config\test2.conf' in \Smarty-2.6.0\libs\Config_File.class.php on line > > 360 > > > > $test2 = testeok2 > > #CONFIG_TEST2 = > > > > > > ?> > > > > it sees that in first template no error does not occur, > > to put in as template, the variable $smarty->config_dir although > > to be modified with the new directory ($smarty->config_dir='.\template_dir2\config > > ';) > > smarty looked test2.conf in the first directory. > > > > the problem is in the file Smarty-2.6.0\libs\plugins\function.config_load.php on line 84 > > to correct the problem the following alteration must be made > > > > diff -r Smarty-2.6.0/libs/plugins/function.config_load.php > > Smarty-2.6.0-bac/libs/plugins/function.config_load.php > > 83,84c83 > > < $smarty->_conf_obj->fix_newlines = > > $smarty->config_fix_newlines; > > < $smarty->_conf_obj->set_path = $_config_dir; > > --- > > > $smarty->_conf_obj->fix_newlines = > > > $smarty->config_fix_newlines; > > 85a85 > > > $smarty->_conf_obj->set_path ( $_config_dir ); > > > > > > yours truly, > > bac@oops.com.br > > Marc Victor C Cabadas > > > >

« previous php.smarty.dev (#1982) next »