Re: [SMARTY] Smarty 2.6.0 RC1 - Bug in path handling
| From: | messju mohr | Date: | Wed, 13 Aug 2003 08:33:44 +0000 |
| Subject: | Re: [SMARTY] Smarty 2.6.0 RC1 - Bug in path handling | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10048@lists.php.net to get a copy of this message | ||
On Tue, Aug 12, 2003 at 11:19:47AM +0100, Mark Rogers wrote:
> [Resent: appears not to have gone first time around.
> Apologies if two arrive on the list.]
>
> 2.6.0 RC1 has a bug when handling $smarty->template_dir if it is an array.
>
> In 2.5.0 it was quite valid (and useful!) to have template_dir as an array
> of template directories.
was this "feature" ever announced and/or documented anywhere?
greetings
messju
> however the way this is parsed in 2.6.0 has
> changed. The problem is in Smarty.class.php in the _parse_resource_name()
> function (line 1730, wrapped here for clarity)
>
> $_resource_base_path =
> isset($params['resource_base_path'])
> ? $params['resource_base_path']
> : array($this->template_dir, '.');
>
> In the case that $params['resource_base_path'] is not set, and if
> $this->template_dir is scalar (ie not an array) this sets
> $_resource_base_path to an array of search paths.
>
> However, if $this->template_dir is already an array the result is a nested
> array, rather than an array combining $this->template_dir and '.' which is
> the desired result.
>
> The following works instead (I'm sure there's a more elegant alternative?):
>
> if (isset($params['resource_base_path'])) {
> $_resource_base_path = $params['resource_base_path'];
> } else {
> $_resource_base_path = (array)$this->template_dir;
> $_resource_base_path[] = '.';
> }
>
> Mark Rogers,
> More Solutions Ltd