[SMARTY] Smarty 2.6.0 RC1 - Bug in path handling

From: Date: Tue, 12 Aug 2003 08:47:36 +0000
Subject: [SMARTY] Smarty 2.6.0 RC1 - Bug in path handling
References: 1  Groups: php.smarty.dev php.smarty.general 
Request: Send a blank email to php-smarty-dev+get-1746@lists.php.net to get a copy of this message
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, 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

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