From 6f473f2820cd4fa9ff2b3e04a08d70c8f408e610 Mon Sep 17 00:00:00 2001 From: messju Date: Mon, 18 Aug 2003 09:28:02 +0000 Subject: [PATCH] allow section-, array- and object-dereference in $smarty-references --- libs/Smarty_Compiler.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 18ee5034..81da18c1 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1864,9 +1864,8 @@ class Smarty_Compiler extends Smarty { { /* Extract the reference name. */ $_ref = substr($indexes[0], 1); - - foreach($indexes as $_index) { - if ($_index{0} != '.') { + foreach($indexes as $_index_no=>$_index) { + if ($_index{0} != '.' && $_index_no<2 || !preg_match('!^(\.|\[|->)!', $_index)) { $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); } }