- improvement replaced most in_array() calls by more efficient isset() on array_flip()ed haystacks

- added notes on possible performance optimization/problem with Smarty_Security
This commit is contained in:
rodneyrehm
2011-10-01 18:10:48 +00:00
parent 41958a5790
commit aff7c6a0ab
13 changed files with 99 additions and 50 deletions
+3 -2
View File
@@ -440,6 +440,7 @@ abstract class Smarty_Resource {
*/
public static function config(Smarty_Internal_Config $_config)
{
static $_incompatible_resources = array('eval' => true, 'string' => true, 'extends' => true, 'php' => true);
$config_resource = $_config->config_resource;
$smarty = $_config->smarty;
@@ -457,8 +458,8 @@ abstract class Smarty_Resource {
$resource_name = $config_resource;
}
}
if (in_array($resource_type, array('eval', 'string', 'extends', 'php'))) {
if (isset($_incompatible_resources[$resource_type])) {
throw new SmartyException ("Unable to use resource '{$resource_type}' for config");
}