Commit 53a2ddf8 by seldaek

fixes #27

Plugins/Helpers that use a dynamic number of arguments through func_get_args are now working since the compiler lets any arguments in excess pass through git-svn-id: svn://dwoo.org/dwoo/trunk@254 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent d630b126
......@@ -12,6 +12,9 @@
+ Added {load_templates} to load external sub-templates into your file
+ Allowed string concatenation assignments with {$foo.="bar"}
+ Allowed access of static properties as {Foo::$bar}
+ Plugins/Helpers that use a dynamic number of arguments through
func_get_args are now working since the compiler lets any arguments in
excess pass through
* Fixed a bug with parsing AND/OR keywords in conditionals when they were
followed by round brackets
* Fixed assignments not handling multi-line values correctly
......
......@@ -2951,6 +2951,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler
foreach ($ps as $i=>$p) {
$tmp[$i] = $p[0];
$tmp2[$i] = $p[1];
unset($ps[$i]);
}
$paramlist[$v[0]] = array($tmp, $tmp2);
unset($tmp, $tmp2, $i, $p);
......@@ -2974,6 +2975,12 @@ class Dwoo_Compiler implements Dwoo_ICompiler
$paramlist[$v[0]] = array(var_export($v[2], true), $v[2]);
}
}
if (count($ps)) {
foreach ($ps as $i=>$p) {
array_push($paramlist, $p);
}
}
return $paramlist;
}
......
......@@ -679,6 +679,18 @@ replace="BAR"
$tpl->forceCompilation();
$this->assertEquals('33/1094/33/33/34', $this->dwoo->get($tpl, array(), $this->compiler));
}
public function testExcessiveArguments()
{
$tpl = new Dwoo_Template_String('{excessArgsHelper a b c d e f}');
$tpl->forceCompilation();
$this->assertEquals('a:b:c:d:e:f', $this->dwoo->get($tpl, array(), $this->compiler));
}
}
function excessArgsHelper($a) {
$args = func_get_args();
return implode(':', $args);
}
class StaticHelper {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment